aboutsummaryrefslogtreecommitdiffstats
path: root/home-manager/soispha/config/neovim/nixvim/autocmds
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-08-03 21:34:16 +0200
committerSoispha <soispha@vhack.eu>2023-08-19 17:34:47 +0200
commitbe1cc38bdb83e6716b08d24cc1201fffc6649311 (patch)
treec3691569e0e8858b672b501096b6cb5edd39daf6 /home-manager/soispha/config/neovim/nixvim/autocmds
parentFeat(treewide): Import nixVim (diff)
downloadnixos-config-be1cc38bdb83e6716b08d24cc1201fffc6649311.zip
Feat(hm/conf/nvim): Add basic nix config [REBASE TARGET]
Diffstat (limited to 'home-manager/soispha/config/neovim/nixvim/autocmds')
-rw-r--r--home-manager/soispha/config/neovim/nixvim/autocmds/default.nix67
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";
+ }
+ ];
+ };
+}