aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-08-26 22:24:01 +0200
committerSoispha <soispha@vhack.eu>2023-08-26 22:56:06 +0200
commitdf2ae83f170b7d3304749bd38883d3ab3b042904 (patch)
tree3a4946514db42624c20a91a8cac6c5b8641f9d42
parentFeat(hm/conf/neovim/autocmds): Highlight yanked text (diff)
downloadnixos-config-df2ae83f170b7d3304749bd38883d3ab3b042904.zip
Fix(hm/conf/neovim/autocmds): Only show colorcolumn in insert 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";
}
{