diff options
| author | Ariel D'ALessandro <dalessandro.ariel@gmail.com> | 2021-07-26 20:57:58 +0200 |
|---|---|---|
| committer | Ariel D'ALessandro <dalessandro.ariel@gmail.com> | 2021-07-26 20:57:58 +0200 |
| commit | 7982e2fae5defeb296c210e2aae098a8a11df25a (patch) | |
| tree | dbcc2ff9d9cec7039635fa0550bbbd02dae82b1a /plugin/lsp.vim | |
| download | nvim-conf-7982e2fae5defeb296c210e2aae098a8a11df25a.tar.gz nvim-conf-7982e2fae5defeb296c210e2aae098a8a11df25a.zip | |
Initialization of the repository, copy from https://github.com/adalessa/dotfiles
Diffstat (limited to 'plugin/lsp.vim')
| -rw-r--r-- | plugin/lsp.vim | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/plugin/lsp.vim b/plugin/lsp.vim new file mode 100644 index 0000000..02b57a1 --- /dev/null +++ b/plugin/lsp.vim @@ -0,0 +1,66 @@ +let g:compe = {} +let g:compe.enabled = v:true +let g:compe.autocomplete = v:true +let g:compe.debug = v:false +let g:compe.min_length = 1 +let g:compe.preselect = 'enable' +let g:compe.throttle_time = 80 +let g:compe.source_timeout = 200 +let g:compe.incomplete_delay = 400 +let g:compe.max_abbr_width = 100 +let g:compe.max_kind_width = 100 +let g:compe.max_menu_width = 100 +let g:compe.documentation = v:true + +let g:compe.source = {} +let g:compe.source.path = v:true +let g:compe.source.buffer = v:true +let g:compe.source.calc = v:true +let g:compe.source.nvim_lsp = v:true +let g:compe.source.nvim_lua = v:true +let g:compe.source.vsnip = v:true + +inoremap <silent><expr> <C-Space> compe#complete() +inoremap <silent><expr> <CR> compe#confirm('<CR>') +inoremap <silent><expr> <C-e> compe#close('<C-e>') +inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 }) +inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 }) + +fun! LspLocationList() + lua vim.lsp.diagnostic.set_loclist({open_loclist = false}) +endfun + +augroup alpha_lsp + autocmd! + autocmd! BufWrite,BufEnter,InsertLeave * :call LspLocationList() +augroup END + +nnoremap <leader>vd :lua vim.lsp.buf.definition()<CR> +nnoremap <leader>vsh :lua vim.lsp.buf.signature_help()<CR> +nnoremap <leader>vh :lua vim.lsp.buf.hover()<CR> + +" to test +nnoremap <leader>vi :lua vim.lsp.buf.implementation()<CR> +nnoremap <leader>vrn :lua vim.lsp.buf.rename()<CR> +nnoremap <leader>vca :lua vim.lsp.buf.code_action()<CR> +nnoremap <leader>vsd :lua vim.lsp.util.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics()<CR> +nnoremap <leader>vn :lua vim.lsp.diagnostic.goto_next()<CR> + +nnoremap <leader>vo :LspRestart<CR> + + +au Filetype php setl omnifunc=v:lua.vim.lsp.omnifunc +autocmd FileType go setlocal omnifunc=v:lua.vim.lsp.omnifunc + +let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy'] + +lua << EOF + +local function on_attach() + vim.api.nvim_set_keymap('n', 'K', ':lua vim.lsp.buf.hover()<cr>', {noremap = true}) +end +require'lspconfig'.tsserver.setup{ on_attach=on_attach } +require'lspconfig'.intelephense.setup{ on_attach=on_attach } +require'lspconfig'.gopls.setup{ on_attach=on_attach } +require'lspconfig'.sumneko_lua.setup{ on_attach=on_attach } +EOF |