Conditionally include lsp

This commit is contained in:
Alex Yatskov 2022-11-15 20:20:48 -08:00
parent 672c44d96a
commit 81cd9a6c79
2 changed files with 45 additions and 34 deletions

View File

@ -8,21 +8,30 @@ local capabilities = cmp_nvim_lsp.default_capabilities({snippetSupport = false})
-- nvim-lspconfig -- nvim-lspconfig
local nvim_lspconfig = require('lspconfig') local nvim_lspconfig = require('lspconfig')
nvim_lspconfig.clangd.setup({capabilities = capabilities}) if vim.fn.executable('clangd') then
nvim_lspconfig.gopls.setup({capabilities = capabilities}) nvim_lspconfig.clangd.setup({capabilities = capabilities})
nvim_lspconfig.jedi_language_server.setup({capabilities = capabilities}) end
nvim_lspconfig.rust_analyzer.setup({capabilities = capabilities}) if vim.fn.executable('gopls') then
nvim_lspconfig.tsserver.setup({capabilities = capabilities}) nvim_lspconfig.gopls.setup({capabilities = capabilities})
nvim_lspconfig.sumneko_lua.setup({ end
settings = { if vim.fn.executable('jedi-language-server') then
Lua = { nvim_lspconfig.jedi_language_server.setup({capabilities = capabilities})
diagnostics = {globals = {'vim'}}, end
runtime = {version = 'LuaJIT'}, if vim.fn.executable('typescript-language-server') then
telemetry = {enable = false}, nvim_lspconfig.tsserver.setup({capabilities = capabilities})
workspace = {library = vim.api.nvim_get_runtime_file('', true)}, end
if vim.fn.executable('lua-language-server') then
nvim_lspconfig.sumneko_lua.setup({
settings = {
Lua = {
diagnostics = {globals = {'vim'}},
runtime = {version = 'LuaJIT'},
telemetry = {enable = false},
workspace = {library = vim.api.nvim_get_runtime_file('', true)},
},
}, },
}, })
}) end
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help) vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition) vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition)

View File

@ -1,26 +1,28 @@
-- fzf.vim -- fzf.vim
vim.g['$FZF_DEFAULT_COMMAND'] = 'ag --hidden --ignore .git -f -g "" 2> /dev/null' if vim.fn.executable('fzf') then
vim.g['$FZF_DEFAULT_COMMAND'] = 'ag --hidden --ignore .git -f -g "" 2> /dev/null'
vim.keymap.set('n', '<leader>fg', vim.cmd.GFiles) vim.keymap.set('n', '<leader>fg', vim.cmd.GFiles)
vim.keymap.set('n', '<leader>fh', vim.cmd.History) vim.keymap.set('n', '<leader>fh', vim.cmd.History)
vim.keymap.set('n', '<leader>fb', vim.cmd.Buffers) vim.keymap.set('n', '<leader>fb', vim.cmd.Buffers)
vim.keymap.set('n', '<leader>fl', vim.cmd.Lines) vim.keymap.set('n', '<leader>fl', vim.cmd.Lines)
vim.g.fzf_colors = { vim.g.fzf_colors = {
['bg'] = {'bg', 'Normal'}, ['bg'] = {'bg', 'Normal'},
['bg+'] = {'bg', 'CursorLine', 'CursorColumn'}, ['bg+'] = {'bg', 'CursorLine', 'CursorColumn'},
['border'] = {'fg', 'Ignore'}, ['border'] = {'fg', 'Ignore'},
['fg'] = {'fg', 'Normal'}, ['fg'] = {'fg', 'Normal'},
['fg+'] = {'fg', 'CursorLine', 'CursorColumn', 'Normal'}, ['fg+'] = {'fg', 'CursorLine', 'CursorColumn', 'Normal'},
['header'] = {'fg', 'Comment'}, ['header'] = {'fg', 'Comment'},
['hl'] = {'fg', 'Comment'}, ['hl'] = {'fg', 'Comment'},
['hl+'] = {'fg', 'Statement'}, ['hl+'] = {'fg', 'Statement'},
['info'] = {'fg', 'PreProc'}, ['info'] = {'fg', 'PreProc'},
['marker'] = {'fg', 'Keyword'}, ['marker'] = {'fg', 'Keyword'},
['pointer'] = {'fg', 'Exception'}, ['pointer'] = {'fg', 'Exception'},
['prompt'] = {'fg', 'Conditional'}, ['prompt'] = {'fg', 'Conditional'},
['spinner'] = {'fg', 'Label'}, ['spinner'] = {'fg', 'Label'},
} }
end
-- hflip.nvim -- hflip.nvim
vim.keymap.set('n', 'gfs', vim.cmd.HFlip) vim.keymap.set('n', 'gfs', vim.cmd.HFlip)