41 lines
1.1 KiB
VimL
41 lines
1.1 KiB
VimL
vim9script
|
|
|
|
# lsp servers
|
|
g:lsp_servers = []
|
|
## clangd
|
|
if executable('clangd')
|
|
add(g:lsp_servers, { name: 'clangd', filetype: ['c', 'cpp', 'h'], path: 'clangd', args: ['--background-index'] })
|
|
endif
|
|
## vimlsp
|
|
if executable('vim-language-server')
|
|
add(g:lsp_servers, { name: 'vimlsp', filetype: ['vim', 'vimrc'], path: 'vim-language-server', args: ['--stdio'] })
|
|
endif
|
|
## Zig - zls
|
|
if executable('zls')
|
|
add(g:lsp_servers, { name: 'zls', filetype: ['zig', 'zir'], path: 'zls', args: [] })
|
|
endif
|
|
## bashls
|
|
if executable('bash-language-server')
|
|
add(g:lsp_servers, { name: 'bashls', filetype: ['sh'], path: 'bash-language-server', args: ['start'] })
|
|
endif
|
|
|
|
# lsp options
|
|
g:lsp_options = {
|
|
autoHighligntDiags: v:true
|
|
}
|
|
|
|
tui#core#plug#Regist('yegappan/lsp', {
|
|
config: () => {
|
|
autocmd User LspSetup call LspOptionsSet(g:lsp_options)
|
|
autocmd User LspSetup call LspAddServer(g:lsp_servers)
|
|
# keymaps
|
|
nnoremap <silent> K :LspHover<CR>
|
|
if exists('g:which_key_map')
|
|
g:which_key_map['v']['o'] = ['LspOutline', 'outline']
|
|
else
|
|
nnoremap <silent> <Leader>vo :LspOutline<CR>
|
|
endif
|
|
}
|
|
})
|
|
|