dippin-dotfiles/.config/kak/utils/whitespace.kak
2025-02-04 21:06:01 -07:00

22 lines
688 B
Text

add-highlighter global/indent show-whitespaces -tab "│" -indent "│" -spc " " -lf " "
define-command softtab-enable %{
hook buffer InsertChar \t %{ try %{
execute-keys -draft "h<a-h><a-k>\A\h+\z<ret><a-;>;%opt{indentwidth}@"
}}
hook buffer InsertDelete ' ' %{ try %{
execute-keys -draft 'h<a-h><a-k>\A\h+\z<ret>i<space><esc><lt>'
}}
}
define-command toggle-whitespace %{
try %{
add-highlighter global/whitespaces show-whitespaces
remove-highlighter global/indent
} catch %{
remove-highlighter global/whitespaces
add-highlighter global/indent show-whitespaces -tab "│" -indent "│" -spc " " -lf " "
}
}