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
126
127
128
129
130
131
|
eval %sh{kak-lsp}
# Disable default server configs
remove-hooks global lsp-filetype-javascript
remove-hooks global lsp-filetype-c-family
remove-hooks global lsp-filetype-ruby
remove-hooks global lsp-filetype-haskell
set-option global lsp_file_watch_support true
set-option global lsp_snippet_support true
set-option global lsp_diagnostic_line_error_sign ''
set-option global lsp_diagnostic_line_warning_sign ''
set-option global lsp_diagnostic_line_info_sign '■'
set-option global lsp_diagnostic_line_hint_sign '■'
lsp-enable
lsp-inlay-diagnostics-enable global
map global user l ': enter-user-mode lsp<ret>' -docstring 'LSP mode'
map global lsp t ': lsp-type-definition<ret>' -docstring 'LSP type definition'
unmap global lsp f
unmap global lsp y
unmap global lsp ]
unmap global lsp [
unmap global lsp 0
unmap global lsp 9
# map global user t ':enter-user-mode tree-sitter<ret>' -docstring 'Treesitter mode'
map global object f '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method'
map global object t '<a-semicolon>lsp-object Class Interface Struct<ret>' -docstring 'LSP class interface or struct'
map global object d '<a-semicolon>lsp-diagnostic-object --include-warnings<ret>' -docstring 'LSP errors and warnings'
map global insert <c-n> '<a-;>: lsp-snippets-select-next-placeholders<ret>' -docstring 'Select next snippet placeholder'
hook global InsertCompletionShow .* %{
unmap global insert <c-n> '<a-;>: lsp-snippets-select-next-placeholders<ret>'
}
hook global InsertCompletionHide .* %{
map global insert <c-n> '<a-;>: lsp-snippets-select-next-placeholders<ret>' -docstring 'Select next snippet placeholder'
}
hook global BufSetOption filetype=(?:javascript|typescript|tsx|jsx) %{
set-option buffer lsp_servers %{
[typescript-language-server]
args = ["--stdio"]
root_globs = ["package.json", "tsconfig.json", "jsconfig.json", ".git"]
settings_section = "_"
[typescript-language-server.settings]
format = { enable = false }
[typescript-language-server.settings._]
quotePreference = "single"
[tailwindcss-language-server]
args = ["--stdio"]
root_globs = ["tailwind.*", "postcss.config.*"]
[tailwindcss-language-server.settings.tailwindCSS]
editor = {}
[biome]
args = ["lsp-proxy"]
root_globs = ["biome.json"]
}
}
hook global BufSetOption filetype=(?:c|cpp|objc) %{
set-option buffer lsp_servers %{
[clangd]
args = [ "--log=verbose", "--clang-tidy" ]
root_globs = ["compile_commands.json", ".clangd", ".git"]
}
}
hook global BufSetOption filetype=ruby %{
set-option buffer lsp_servers %{
[ruby-lsp]
args = ["stdio"]
root_globs = ["Gemfile"]
[rubocop]
command = "bundle"
args = ["exec", "rubocop", "--lsp"]
root_globs = ["Gemfile", ".git"]
}
}
hook -group lsp-filetype-haskell global BufSetOption filetype=haskell %{
set-option buffer lsp_servers %{
[haskell-language-server]
command = "haskell-language-server-wrapper"
args = ["--lsp"]
root_globs = ["hie.yaml", "cabal.project", "Setup.hs", "stack.yaml", "*.cabal"]
settings_section = "_"
[haskell-language-server.settings]
hlintOn = true
[haskell-language-server.settings._]
haskell.formattingProvider = "ormolu"
}
}
hook global BufCreate .*[.]ua %{ set-option buffer filetype uiua }
hook global BufSetOption filetype=uiua %{
set-option buffer lsp_servers %{
[uiua]
args = [ "lsp" ]
root_globs = [ "main.ua", ".fmt.ua", ".git" ]
}
# Auto-formatter for uiua (TODO: Move to formatter.kak)
hook buffer BufWritePre .* %{ lsp-formatting-sync }
}
hook global WinSetOption filetype=.* %{
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 }
set-option window lsp_semantic_tokens %{
[
{face="documentation", token="comment", modifiers=["documentation"]},
{face="comment", token="comment"},
{face="function", token="function"},
{face="function", token="method"},
{face="keyword", token="keyword"},
{face="module", token="namespace"},
{face="operator", token="operator"},
{face="string", token="string"},
{face="type", token="type"},
{face="variable", token="variable"},
{face="const_variable", token="variable", modifiers=["readonly"]},
{face="const_variable", token="variable", modifiers=["constant"]},
]
}
}
|