[[plugins]] repo = 'neovim/nvim-lsp' # repo = 'h-michael/nvim-lsp' # rev = '' on_if = 'has("nvim-0.5")' on_cmd = ['LspInstall', 'LspInstallInfo'] on_ft = [ 'c', 'cpp', 'go', 'rust' , 'python', 'ruby', 'php', 'javascript', 'typescript', 'typescriptreact','ada', 'json', 'yaml', 'yaml.docker-compose', 'terraform, dart, vue' ] hook_add = ''' lua << EOF vim.lsp.set_log_level("debug") EOF function! SetMyLspConfig() abort setlocal omnifunc=v:lua.vim.lsp.omnifunc nnoremap lua vim.lsp.buf.definition() nnoremap lua vim.lsp.buf.signature_help() nnoremap K lua vim.lsp.buf.hover() nnoremap gde lua vim.lsp.buf.declaration() nnoremap gdo lua vim.lsp.buf.document_symbol() nnoremap gi lua vim.lsp.buf.implementation() nnoremap td lua vim.lsp.buf.type_definition() nnoremap rf lua vim.lsp.buf.references({ includeDeclaration = true }) nnoremap fmt lua vim.lsp.buf.formatting() nnoremap rn lua vim.lsp.buf.rename() endfunction ''' [plugins.ftplugin] c = ''' if exists('g:my_c_lsp_loaded') finish else let g:my_c_lsp_loaded = 1 lua << EOF require'nvim_lsp'.clangd.setup{ cmd = {"clangd", "--background-index"}; } EOF autocmd Filetype c call SetMyLspConfig() endif ''' cpp = ''' if !exists('g:my_cpp_lsp_loaded') let g:my_cpp_lsp_loaded = 1 lua require'nvim_lsp'.clangd.setup{ cmd = {"clangd", "--background-index"}; } autocmd Filetype cpp call SetMyLspConfig() endif ''' go = ''' if !exists('g:my_go_lsp_loaded') let g:my_go_lsp_loaded = 1 lua << EOF -- https://github.com/golang/tools/blob/master/gopls/doc/settings.md#settings require'nvim_lsp'.gopls.setup{ init_options = { usePlaceholders=true; linkTarget="pkg.go.dev"; completionDocumentation=true; completeUnimported=true; deepCompletion=true; fuzzyMatching=true; }; } EOF autocmd Filetype go call SetMyLspConfig() endif ''' rust = ''' if !exists('g:my_rust_lsp_loaded') let g:my_rust_lsp_loaded = 1 " let g:use_rust_analyzer = 1 if exists('g:use_rust_analyzer') lua require'nvim_lsp'.rust_analyzer.setup{} else lua << EOF -- https://github.com/neovim/nvim-lsp#rls require'nvim_lsp'.rls.setup{ cmd = {"rustup", "run", "stable", "rls"}; settings = { rust = { all_features = true; all_targets = true; full_docs = true; jobs = 2; unstable_features = true; wait_to_build = 1500; }; }; } EOF endif autocmd Filetype rust call SetMyLspConfig() endif ''' ruby = ''' if !exists('g:my_ruby_lsp_loaded') let g:my_ruby_lsp_loaded = 1 lua require'nvim_lsp'.solargraph.setup{} autocmd Filetype ruby call SetMyLspConfig() endif ''' python = ''' if !exists('g:my_python_lsp_loaded') let g:my_python_lsp_loaded = 1 let g:use_pyls_ms = 1 if exists('g:use_pyls_ms') lua << EOF require'nvim_lsp'.pyls_ms.setup{ cmd = {"pyls-ms"}; } EOF else lua require'nvim_lsp'.pyls.setup{} endif autocmd Filetype python call SetMyLspConfig() endif ''' lua = ''' if !exists('g:my_lua_lsp_loaded') let g:my_lua_lsp_loaded = 1 lua << EOF local os_getenv = vim.loop.os_getenv; require'nvim_lsp'.sumneko_lua.setup{ cmd = {os_getenv('LUA_LSP_BIN'), "-E", os_getenv('LUA_LSP_DIR')..'/main.lua'}; settings = { Lua = { diagnostics = { enable = true; global = {"vim"}; }; }; }; } EOF autocmd Filetype lua call SetMyLspConfig() endif ''' javascript = ''' if !exists('g:my_javascript_lsp_loaded') let g:my_javascript_lsp_loaded = 1 lua << EOF require'nvim_lsp'.tsserver.setup{} EOF autocmd Filetype javascript call SetMyLspConfig() endif ''' typescript = ''' if !exists('g:my_typescript_lsp_loaded') let g:my_typescript_lsp_loaded = 1 lua require'nvim_lsp'.tsserver.setup{} autocmd Filetype typescript call SetMyLspConfig() endif ''' typescriptreact = ''' if !exists('g:my_typescriptreact_lsp_loaded') let g:my_typescriptreact_lsp_loaded = 1 lua require'nvim_lsp'.tsserver.setup{} autocmd Filetype typescriptreact call SetMyLspConfig() endif ''' json = ''' if !exists('g:my_json_lsp_loaded') let g:my_json_lsp_loaded = 1 lua require'nvim_lsp'.jsonls.setup{} autocmd Filetype json call SetMyLspConfig() endif ''' yaml = ''' if !exists('g:my_yaml_lsp_loaded') let g:my_yaml_lsp_loaded = 1 lua require'nvim_lsp'.yamlls.setup{} autocmd Filetype yaml call SetMyLspConfig() endif ''' # "yaml.docker-compose" = ''' # lua require'nvim_lsp'.yamlls.setup{} # autocmd Filetype yaml.docker-compose call SetMyLspConfig() # ''' terraform = ''' if !exists('g:my_terraform_lsp_loaded') let g:my_terraform_lsp_loaded = 1 lua require'nvim_lsp'.terrafomls.setup{} autocmd Filetype terraform call SetMyLspConfig() endif ''' dart = ''' if !exists('g:my_dart_lsp_loaded') let g:my_dart_lsp_loaded = 1 lua require'nvim_lsp'.dartls.setup{} autocmd Filetype dart call SetMyLspConfig() endif ''' vue = ''' if !exists('g:my_vue_lsp_loaded') let g:my_vue_lsp_loaded = 1 lua require'nvim_lsp'.vuels.setup{} autocmd Filetype vue call SetMyLspConfig() endif ''' php = ''' if !exists('g:my_php_lsp_loaded') let g:my_php_lsp_loaded = 1 lua require'nvim_lsp'.intelephense.setup{} autocmd Filetype php call SetMyLspConfig() endif ''' "ada = ''' "if !exists('g:my_ada_lsp_loaded') " let g:my_ada_lsp_loaded = 1 " " lua require'nvim_lsp'.als.setup{} " autocmd Filetype ada call SetMyLspConfig() "endif "''' [[plugins]] repo = 'h-michael/lsp-ext.nvim' on_source = ['nvim-lsp'] hook_source = ''' lua << EOF vim.g["lsp_publish_diagnostics_virtualtext"] = false lsp_ext = require'lsp_ext' lsp_ext.set_signature_help_autocmd(100) lsp_ext.set_publish_diagnostics_autocmd(100) EOF '''