From df2ae83f170b7d3304749bd38883d3ab3b042904 Mon Sep 17 00:00:00 2001 From: Soispha Date: Sat, 26 Aug 2023 22:24:01 +0200 Subject: Fix(hm/conf/neovim/autocmds): Only show colorcolumn in insert mode --- .../soispha/config/neovim/nixvim/autocmds/default.nix | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 = ["*"]; @@ -46,6 +48,21 @@ description = "Display cursorline and cursorcolumn ONLY in active window."; } + { + 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 = ["*"]; @@ -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"; } { -- cgit 1.4.1