about summary refs log tree commit diff stats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--home-manager/soispha/config/neovim/nixvim/autocmds/default.nix19
1 files changed, 18 insertions, 1 deletions
diff --git a/home-manager/soispha/config/neovim/nixvim/autocmds/default.nix b/home-manager/soispha/config/neovim/nixvim/autocmds/default.nix
index d00bace1..cb0311fb 100644
--- a/home-manager/soispha/config/neovim/nixvim/autocmds/default.nix
+++ b/home-manager/soispha/config/neovim/nixvim/autocmds/default.nix
@@ -2,6 +2,7 @@
   programs.nixvim = {
     autoGroups = {
       cursor_off = {clear = true;};
+      colorcolumn_toggle = {clear = true;};
       numbertoggle = {clear = true;};
       coloroverride = {clear = true;};
       highlight_on_yank = {clear = true;};
@@ -31,6 +32,7 @@
           :%s/\s\+$\| \+\ze\t//g >> For trailing spaces and spaces before tabstops
         '';
       }
+
       {
         event = ["WinLeave"];
         pattern = ["*"];
@@ -47,6 +49,21 @@
       }
 
       {
+        event = ["InsertEnter"];
+        pattern = ["*"];
+        command = "set colorcolumn=${config.programs.nixvim.options.colorcolumn}";
+        group = "colorcolumn_toggle";
+        description = "Only activate the colorcolumn when focused";
+      }
+      {
+        event = ["BufLeave" "FocusLost" "InsertLeave" "WinLeave"];
+        pattern = ["*"];
+        command = "set colorcolumn=0";
+        group = "colorcolumn_toggle";
+        description = "Only activate the colorcolumn when focused";
+      }
+
+      {
         event = ["BufEnter" "FocusGained" "InsertLeave" "WinEnter"];
         pattern = ["*"];
         command = "if &nu && mode() != \"i\" | set rnu   | endif";
@@ -58,7 +75,7 @@
         pattern = ["*"];
         command = "if &nu | set nornu | endif";
         group = "numbertoggle";
-        description = "Change line numbers, when not fucused";
+        description = "Change line numbers, when not focused";
       }
 
       {