/
lsp.toml
258 lines (238 loc) · 5.5 KB
/
lsp.toml
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# LSP plugins
# Core plugins {{{
[[plugins]] # nvim-lspconfig
repo = 'neovim/nvim-lspconfig'
depends = 'neodev.nvim'
[[plugins]] # mason.nvim
repo = 'williamboman/mason.nvim'
lua_source = '''
-- <% ./dein_toml/mason.lua
require("mason").setup({
ui = {
border = "single",
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "✗ ",
},
},
})
-- %>
'''
[[plugins]] # mason-lspconfig.nvim
repo = 'williamboman/mason-lspconfig.nvim'
depends = ['nvim-lspconfig', 'mason.nvim', 'lspsaga.nvim']
on_ft = ['lua', 'php', 'python', 'toml', 'markdown', 'vim', 'yaml', 'dockerfile', 'sh']
hook_add = '''
" LSP keybinds
nnoremap <lsp>k <Cmd>Lspsaga hover_doc<CR>
nnoremap <lsp>K <Cmd>Lspsaga lsp_finder<CR>
nnoremap <lsp>r <Cmd>Lspsaga rename<CR>
nnoremap <lsp>o <Cmd>Lspsaga outline<CR>
nnoremap <lsp>c <Cmd>Lspsaga code_action<CR>
nnoremap <lsp>h <Cmd>lua vim.lsp.buf.signature_help()<CR>
nnoremap <lsp>f <Cmd>lua vim.lsp.buf.format()<CR>
nnoremap <lsp>i <Cmd>lua vim.lsp.buf.implementation<CR>
nnoremap <lsp>d <Cmd>Lspsaga peek_definition<CR>
nnoremap <lsp>D <Cmd>lua vim.lsp.buf.declaration()<CR>
nnoremap <lsp>e <Cmd>Lspsaga show_line_diagnostics<CR>
nnoremap <lsp>E <Cmd>Lspsaga show_cursor_diagnostics<CR>
nnoremap <lsp>q <Cmd>Lspsaga show_buf_diagnostics<CR>
nnoremap [d <Cmd>Lspsaga diagnostic_jump_prev<CR>
nnoremap ]d <Cmd>Lspsaga diagnostic_jump_next<CR>
'''
lua_source = '''
-- <% ./dein_toml/lspconfig.lua
local mason_lspconfig = require("mason-lspconfig")
local lspconfig = require("lspconfig")
--local keymap = vim.keymap.set
local lsp = vim.lsp -- nvim lsp api.
--local diag = vim.diagnostic -- nvim diagnostic api.
mason_lspconfig.setup({
ensure_installed = {
"lua_ls",
"intelephense",
"pyright",
"yamlls",
"bashls",
},
automatic_installation = true,
})
mason_lspconfig.setup_handlers({
function(server_name)
local lsp_options = {}
local capabilities = lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
if server_name == "lua_ls" then
lsp_options.capabilities = capabilities
end
lspconfig[server_name].setup(lsp_options)
end,
})
-- %>
'''
# }}}
# Support plugins {{{
[[plugins]] # lspsaga.nvim
repo = 'glepnir/lspsaga.nvim'
lua_source = '''
-- <% ./dein_toml/lspsaga.lua
require("lspsaga").setup({
ui = {
theme = "round",
border = "single",
},
finder = {
edit = { "o", "<CR>" },
vsplit = "v",
split = "s",
tabe = "t",
quit = { "q", "<ESC>" },
},
definition = {
edit = "<C-c>o",
vsplit = "<C-c>v",
split = "<C-c>s",
tabe = "<C-c>t",
quit = "q",
close = "<Esc>",
},
code_action = {
num_shortcut = true,
keys = {
quit = "q",
exec = "<CR>",
},
},
lightbulb = {
enable = true,
enable_in_insert = false,
sign = true,
sign_priority = 40,
virtual_text = false,
},
rename = {
quit = "q",
exec = "<CR>",
in_select = false,
},
outline = {
win_position = "right",
win_with = "",
win_width = 30,
show_detail = true,
auto_preview = false,
auto_refresh = true,
auto_close = true,
custom_sort = nil,
keys = {
jump = "o",
expand_collaspe = "u",
quit = "q",
},
},
symbol_in_winbar = {
enable = true,
separator = " ",
hide_keyword = true,
show_file = false,
folder_level = 2,
},
})
-- %>
'''
[[plugins]] # denops-popup-preview.vim
repo = 'matsui54/denops-popup-preview.vim'
on_event = 'LspAttach'
hook_source = '''
call popup_preview#enable()
'''
[[plugins]] # denops-signature_help
repo = 'matsui54/denops-signature_help'
on_event = 'LspAttach'
hook_source = '''
call signature_help#enable()
'''
[[plugins]] # fidget.nvim
repo = 'j-hui/fidget.nvim'
on_event = 'LspAttach'
lua_source = '''
-- <% ./dein_toml/fidget.lua
require("fidget").setup({
text = {
spinner = "dots",
},
window = {
border = "single",
relative = "editor",
},
sources = {
["null-ls"] = {
ignore = true,
},
},
})
-- %>
'''
[[plugins]] # neodev.nvim
repo = 'folke/neodev.nvim'
lua_source = '''
require("neodev").setup({})
'''
# }}}
# null_ls {{{
[[plugins]] # plenary.nvim(null-ls depends of this plugin)
repo = 'nvim-lua/plenary.nvim'
[[plugins]] # null-ls.nvim
repo = 'jose-elias-alvarez/null-ls.nvim'
depends = 'plenary.nvim'
lua_source = '''
-- <% ./dein_toml/null_ls.lua
local null_ls = require("null-ls")
local code_actions = null_ls.builtins.code_actions
local completion = null_ls.builtins.completion
local diagnostics = null_ls.builtins.diagnostics
local formatting = null_ls.builtins.formatting
--local hover = null_ls.builtins.hover
local sources = {
code_actions.gitsigns,
completion.vsnip,
formatting.stylua,
formatting.taplo,
formatting.yamlfmt,
formatting.textlint.with({
filetypes = { "markdown" },
prefer_local = "node_modules/.bin",
}),
diagnostics.yamllint,
diagnostics.hadolint,
diagnostics.textlint.with({
filetypes = { "markdown" },
prefer_local = "node_modules/.bin",
}),
}
null_ls.setup({
border = "single",
diagnostics_format = "[#{c}] #{m} (#{s})",
sources = sources,
})
-- %>
'''
[[plugins]] # mason-null-ls.nvim
repo = 'jay-babu/mason-null-ls.nvim'
depends = 'null-ls.nvim'
on_source = 'mason-lspconfig.nvim'
lua_source = '''
-- <% ./dein_toml/mason_null_ls.lua
require("mason-null-ls").setup({
ensure_installed = nil,
automatic_installation = {
exclude = {
"textlint",
},
},
automatic_setup = false,
})
-- %>
'''
# }}}