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,11 +8,19 @@ local capabilities = cmp_nvim_lsp.default_capabilities({snippetSupport = false})
-- nvim-lspconfig
local nvim_lspconfig = require('lspconfig')
if vim.fn.executable('clangd') then
nvim_lspconfig.clangd.setup({capabilities = capabilities})
end
if vim.fn.executable('gopls') then
nvim_lspconfig.gopls.setup({capabilities = capabilities})
end
if vim.fn.executable('jedi-language-server') then
nvim_lspconfig.jedi_language_server.setup({capabilities = capabilities})
nvim_lspconfig.rust_analyzer.setup({capabilities = capabilities})
end
if vim.fn.executable('typescript-language-server') then
nvim_lspconfig.tsserver.setup({capabilities = capabilities})
end
if vim.fn.executable('lua-language-server') then
nvim_lspconfig.sumneko_lua.setup({
settings = {
Lua = {
@ -23,6 +31,7 @@ nvim_lspconfig.sumneko_lua.setup({
},
},
})
end
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition)

View File

@ -1,4 +1,5 @@
-- fzf.vim
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)
@ -21,6 +22,7 @@ vim.g.fzf_colors = {
['prompt'] = {'fg', 'Conditional'},
['spinner'] = {'fg', 'Label'},
}
end
-- hflip.nvim
vim.keymap.set('n', 'gfs', vim.cmd.HFlip)