kakoune improvements

This commit is contained in:
Maddie H 2023-04-21 22:44:21 +01:00
parent 17a41fe2a9
commit ebb5ec4600
Signed by: maddie
GPG Key ID: C296DE8C9053683F

View File

@ -23,15 +23,15 @@
setTitle = true; setTitle = true;
}; };
hooks = [ hooks = [
{ {
name = "WinSetOption"; name = "WinSetOption";
option = "filetype=nix"; option = "filetype=nix";
commands = '' commands = ''
set-option window indentwidth 2 set-option window indentwidth 2
set-option window formatcmd nixpkgs-fmt set-option window formatcmd nixpkgs-fmt
''; '';
} }
]; ];
}; };
plugins = with pkgs.kakounePlugins; [ plugins = with pkgs.kakounePlugins; [
kakoune-rainbow kakoune-rainbow
@ -40,9 +40,36 @@
pkgs.kak-lsp pkgs.kak-lsp
]; ];
extraConfig = '' extraConfig = ''
# Tabs
hook global InsertChar \t %{ exec -draft h@ } hook global InsertChar \t %{ exec -draft h@ }
add-highlighter global/ show-whitespaces -tab '' -tabpad ''
# Kak-LSP
eval %sh{kak-lsp --kakoune -s $kak_session} eval %sh{kak-lsp --kakoune -s $kak_session}
lsp-enable lsp-enable
# Modeline
declare-option bool lsp_enabled false
declare-option -hidden str lsp_modeline_progress ""
define-command -hidden -params 6 -override lsp-handle-progress %{
set-option global lsp_modeline_progress %sh{
if ! "$6"; then
echo "$2\$\{5:+" ($5%)"}\$\{4:+": $4"}"
fi
}
}
declare-option -hidden str modeline_git_branch
hook global WinDisplay .* %{
set-option window modeline_git_branch %sh{
branch=$(git -C "\$\{kak_buffile%/*}" rev-parse --abbrev-ref HEAD 2>/dev/null)
if [ -n "$branch" ]; then
printf "$branch "
fi
}
}
set-option global modelinefmt '%opt{lsp_modeline_progress} {StatusLine}{string}%opt{modeline_git_branch}{type}%sh{ [ -n "$kak_opt_filetype" ] && echo "$kak_opt_filetype " }{default}%val{bufname}{{context_info}}{default} {{mode_info}} {meta}%val{cursor_line}:%val{cursor_char_column}'
''; '';
}; };
} }