-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkakrc
119 lines (99 loc) · 3.71 KB
/
kakrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
add-highlighter global/ number-lines
add-highlighter global/ wrap
colorscheme tomorrow-night
face global Default default,default
face global LineNumbers default,default+fgd@LineNumbers
face global BufferPadding default,default
eval %sh{kak-lsp --kakoune -s $kak_session}
set global lsp_cmd "kak-lsp -s %val{session} -vvv --log /tmp/kak-lsp.log"
source "%val{config}/shellcheck.kak"
set global autoreload true
set global tabstop 4
set global indentwidth 0
set global ui_options terminal_info_max_width=100
hook global WinSetOption filetype=(go|c|cpp|java|python|javascript|typescript|rust) %{
lsp-enable-window
set-option window lsp_auto_highlight_references true
set-option window lsp_hover_anchor false
set-option window lsp_hover_max_lines 10
lsp-auto-hover-enable
lsp-inlay-code-lenses-enable window
echo -debug "Enabling LSP for filetype %opt{filetype}"
}
set global lsp_diagnostic_line_error_sign '║'
set global lsp_diagnostic_line_warning_sign '┊'
map -docstring "lsp mode" global user l ':enter-user-mode lsp<ret>'
map -docstring "lsp rename" global user r ':lsp-rename-prompt<ret>'
hook global KakEnd .* lsp-exit
define-command -override -hidden lsp-show-error -params 1 -docstring "Render error (suppress useless lsp errors)" %{
evaluate-commands %sh{
# useless gopls error
if [ "$1" = "go language server error: 'no object found'" ]; then
exit 0
fi
echo 'echo -debug "kak-lsp:" %arg{1}'
echo 'info %arg{1}'
}
}
hook global WinSetOption filetype=go %{
set-option window formatcmd 'goimports'
hook buffer BufWritePre .* %{
format
}
}
hook global WinSetOption filetype=nix %{
set-option window formatcmd 'nixpkgs-fmt'
hook buffer BufWritePre .* %{
format
}
}
hook global WinSetOption filetype=terraform %{
set window formatcmd 'terraform fmt -'
map window insert <s-tab> '<a-;> '
map window insert <tab> '<a-;> '
set window indentwidth 2
hook buffer BufWritePre .* %{format}
}
hook global WinSetOption filetype=sh %{
set window formatcmd 'shfmt'
hook buffer BufWritePre .* %{format}
}
hook global WinSetOption filetype=rust %{
set window formatcmd 'rustfmt --edition 2021'
hook buffer BufWritePre .* %{format}
}
hook global WinSetOption filetype=(c|cpp) %{
# set window formatcmd 'clang-format --fallback-style=WebKit'
# hook buffer BufWritePre .* %{format}
}
hook global WinSetOption filetype=yaml %{
map window insert <s-tab> '<a-;> '
map window insert <tab> '<a-;> '
set window indentwidth 2
# set window formatcmd 'yq read -d"*" -'
}
hook global WinSetOption filetype=latex %{
hook buffer BufWritePost .* %{
nop %sh{
PDF="$(dirname "$kak_buffile")/$(basename "$kak_buffile" .tex).pdf"
if [ -z "$(ps | grep "evince $PDF")" ]; then
evince "$PDF" > /dev/null 2>&1 < /dev/null &
fi
cd "$(dirname "$kak_buffile")"
latexmk -pdf &
}
}
}
map -docstring "edit .tmux.conf" global user t ':e ~/.tmux.conf<ret>'
map -docstring "edit kakrc" global user e ':e ~/.config/kak/kakrc<ret>'
map -docstring "edit bashrc" global user b ':e ~/.bashrc<ret>'
map -docstring "wl-paste" global user p '!wl-paste -n<ret>'
map -docstring "lsp-hover-buffer" global user H ':lsp-hover-buffer<ret>'
map -docstring "lsp-code-actions" global user a ':lsp-code-actions<ret>'
hook global RegisterModified '"' %{ nop %sh{
printf %s "$kak_main_reg_dquote" | wl-copy > /dev/null 2>&1 &
}}
map global normal '#' ':comment-line<ret>'
map -docstring 'split vertically' global user d ':tmux-terminal-horizontal kak -c %val{session}<ret>'
map -docstring 'split horizontally' global user D ':tmux-terminal-vertical kak -c %val{session}<ret>'
map -docstring "kaktree" global user k ':kaktree-toggle<ret>'