diff options
Diffstat (limited to 'home-manager/soispha/config/neovim/nixvim/autocmds/default.nix')
-rw-r--r-- | home-manager/soispha/config/neovim/nixvim/autocmds/default.nix | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/home-manager/soispha/config/neovim/nixvim/autocmds/default.nix b/home-manager/soispha/config/neovim/nixvim/autocmds/default.nix new file mode 100644 index 00000000..d736443e --- /dev/null +++ b/home-manager/soispha/config/neovim/nixvim/autocmds/default.nix @@ -0,0 +1,67 @@ +{...}: { + programs.nixvim = { + autoGroups = { + cursor_off = {clear = true;}; + numbertoggle = {clear = true;}; + }; + autoCmd = [ + { + event = ["BufWritePre"]; + pattern = ["*"]; + command = '' + ks | if search("\\s\\+$", 'n') != 0 :%s/\s\+//g endif | 's"; + ''; + description = '' + Remove trailing whitespace on safe + :%s/\s\+$\| \+\ze\t//g >> For trailing spaces and spaces before tabstops + ''; + } + { + event = ["WinLeave"]; + pattern = ["*"]; + command = "set nocursorline"; # TODO possible also nocursorcolumn + group = "cursor_off"; + description = "Display cursorline and cursorcolumn ONLY in active window."; + } + { + event = ["WinEnter"]; + pattern = ["*"]; + command = "set cursorline"; # TODO possible also cursorcolumn + group = "cursor_off"; + description = "Display cursorline and cursorcolumn ONLY in active window."; + } + + { + event = ["BufEnter" "FocusGained" "InsertLeave" "WinEnter"]; + pattern = ["*"]; + command = "if &nu && mode() != \"i\" | set rnu | endif"; + group = "numbertoggle"; + description = "Change line numbers, when not focused"; + } + { + event = ["BufLeave" "FocusLost" "InsertEnter" "WinLeave"]; + pattern = ["*"]; + command = "if &nu | set nornu | endif"; + group = "numbertoggle"; + description = "Change line numbers, when not fucused"; + } + + { + # Override LineNr + event = ["ColorScheme"]; + pattern = ["*"]; + command = "highlight LineNr ctermfg=DarkGrey guifg=DarkGrey "; + group = "coloroverride"; + description = "Changes Line number colors"; + } + { + # Override CursorLineNr + event = ["ColorScheme"]; + pattern = ["*"]; + command = "highlight CursorLineNr ctermfg=White guifg=White "; + group = "coloroverride"; + description = "Changes Line number colors"; + } + ]; + }; +} |