diff --git a/user/kakoune/colors.nix b/user/kakoune/colors.nix index a0917d4..ae3f2a8 100644 --- a/user/kakoune/colors.nix +++ b/user/kakoune/colors.nix @@ -14,6 +14,9 @@ let orange = color.normal.orange; brown = color.normal.brown; }; + + cursorNormalSpec = "${colors.accent_fg},${colors.accent_color}+fg"; + cursorInsertSpec = "black,bright-green+b"; in with colors; '' @@ -49,8 +52,11 @@ with colors; # builtin faces face global Default default,default - face global PrimaryCursor ${accent_fg},${accent_color}+fg + face global PrimaryCursor ${cursorNormalSpec} face global PrimaryCursorEol PrimaryCursor + + declare-option str cursor_normal_face '${cursorNormalSpec}' + declare-option str cursor_insert_face '${cursorInsertSpec}' face global PrimarySelection default,${bg_light}+f face global SecondaryCursor default,default+rfg diff --git a/user/kakoune/hooks.kak b/user/kakoune/hooks.kak index 5bc243e..c1f55ad 100644 --- a/user/kakoune/hooks.kak +++ b/user/kakoune/hooks.kak @@ -2,6 +2,16 @@ set global idle_timeout 500 enable-auto-pairs +hook -group tell-mode global ModeChange push:.*:insert %{ + set-face window PrimaryCursor %opt{cursor_insert_face} + set-face window PrimaryCursorEol %opt{cursor_insert_face} +} + +hook -group tell-mode global ModeChange pop:insert:.* %{ + set-face window PrimaryCursor %opt{cursor_normal_face} + set-face window PrimaryCursorEol %opt{cursor_normal_face} +} + hook global NormalIdle .* %{ evaluate-commands %sh{ hex_with_size() { for i in 3 4 6 8; do