-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplug.kak
126 lines (115 loc) · 4.47 KB
/
plug.kak
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
120
121
122
123
124
125
# Plugins
# ───────
# plugin manager
evaluate-commands %sh{
plugins="$kak_config/plugins"
mkdir -p "$plugins"
[ ! -e "$plugins/plug.kak" ] && \
git clone -q https://github.com/andreyorst/plug.kak.git "$plugins/plug.kak"
printf "%s\n" "source '$plugins/plug.kak/rc/plug.kak'"
}
plug "andreyorst/plug.kak" noload
## Buffers
plug 'delapouite/kakoune-buffers' %{
map global user b ': enter-user-mode buffers<ret>' -docstring 'buffers'
map global buffers g ': buffer-by-index ' -docstring 'go to by index'
map global buffers b ': pick-buffers<ret>' -docstring 'pick buffer'
}
plug "natasky/kakoune-multi-file"
# set-option global windowing_modules 'X11'
# plug 'delapouite/kakoune-i3' %{
# # Suggested mapping
# map global user 3 ': enter-user-mode i3<ret>' -docstring 'i3 mode'
# }
## Text
# handle () {} "" ...
plug "h-youhei/kakoune-surround" %{
declare-user-mode surround
map global normal '<c-s>' ': enter-user-mode surround<ret>'
map global surround s ': surround<ret>' -docstring 'surround'
map global surround c ': change-surround<ret>' -docstring 'change'
map global surround d ': delete-surround<ret>' -docstring 'delete'
map global surround t ': select-surrounding-tag<ret>' -docstring 'select tag'
}
plug "alexherbo2/auto-pairs.kak" %{
enable-auto-pairs
}
plug "caksoylar/kakoune-focus" config %{
map global user 'f' ': focus-toggle<ret>' -docstring 'focus selection'
}
# completion
plug "ul/kak-lsp" do %{
cargo build --release --locked
cargo install --force --path .
} config %{
set-option global lsp_completion_trigger "execute-keys 'h<a-h><a-k>\S[^\h\n,=;*(){}\[\]]\z<ret>'"
set-option global lsp_diagnostic_line_error_sign "!"
set-option global lsp_diagnostic_line_warning_sign "•"
hook global WinSetOption filetype=* %{
set-option window lsp_hover_anchor false
}
hook global WinSetOption filetype=(cmake|sh) %{
map window user 'l' ': enter-user-mode lsp<ret>' -docstring 'LSP mode'
lsp-enable-window
set-option buffer lsp_servers %{
[cmake]
filetype= "cmake"
command= "cmake-language-server"
root = "build"
}
set-option buffer lsp_servers %{
[bash]
filetypes= ["sh","bash"]
root= ".git"
command= "bash-language-server"
args= ["start"]
}
}
hook global WinSetOption filetype=(c|cpp|rust) %{
map window user 'l' ': enter-user-mode lsp<ret>' -docstring 'LSP mode'
lsp-enable-window
lsp-auto-hover-disable
lsp-auto-hover-insert-mode-disable
set-face window DiagnosticError default+u
set-face window DiagnosticWarning default+u
hook window -group semantic-tokens BufReload .* lsp-semantic-tokens
hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens
hook window -group semantic-tokens InsertIdle .* lsp-semantic-tokens
hook -once -always window WinSetOption filetype=.* %{
remove-hooks window semantic-tokens
}
}
hook global WinSetOption filetype=python %{
map window user 'l' ': enter-user-mode lsp<ret>' -docstring 'LSP mode'
lsp-enable-window
lsp-auto-hover-disable
lsp-auto-hover-insert-mode-disable
hook window -group semantic-tokens BufReload .* lsp-semantic-tokens
hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens
hook window -group semantic-tokens InsertIdle .* lsp-semantic-tokens
hook -once -always window WinSetOption filetype=.* %{
remove-hooks window semantic-tokens
}
}
hook global WinSetOption filetype=rust %{
set-option window lsp_server_configuration rust.clippy_preference="on"
}
# inlay
hook global WinSetOption filetype=(rust|python|nim|go|javascript|typescript|c|cpp) %{
lsp-inlay-diagnostics-enable buffer
hook buffer ModeChange pop:insert:normal %{ lsp-inlay-diagnostics-enable buffer }
hook buffer ModeChange push:normal:insert %{ lsp-inlay-diagnostics-disable buffer }
}
# clean
hook global KakEnd .* lsp-exit
}
# snippets
declare-option str-list snippets_directories "%val{config}/snippets"
plug "occivink/kakoune-snippets" config %{
set-option -add global snippets_directories "%opt{plug_install_dir}/kakoune-snippet-collection/snippets"
set-option global snippets_auto_expand false
map global insert '<c-s>' '<a-;>: snippets-expand-trigger<ret><esc>'
map global insert '<c-n>' '<a-;>: snippets-select-next-placeholders<ret><esc>'
map global normal '<c-n>' ': snippets-select-next-placeholders<ret>'
}
plug "andreyorst/kakoune-snippet-collection"