Browse Source

plugins: added nvim-lspinstall

my-config
NTBBloodbath 4 years ago
parent
commit
4ff36aee36
No known key found for this signature in database GPG Key ID: 18D6730BC846AAC5
  1. 31
      lua/configs/lsp.lua
  2. 16
      lua/plugins.lua

31
lua/configs/lsp.lua

@ -1,12 +1,15 @@
-- taken from https://github.com/neovim/nvim-lspconfig#keybindings-and-completion
-- changed servers and ctermbg=237
-- added buf_set_keymap('n', 'ga', '<Cmd>lua vim.lsp.buf.code_action()<CR>', opts)
nvim_lsp = require('lspconfig')
local nvim_lsp = require('lspconfig')
-- Snippets support
capabilities = vim.lsp.protocol.make_client_capabilities()
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
-- Signature help
require('lsp_signature').on_attach()
-- Vscode-like pictograms on completion
require('lspkind').init({
with_text = true,
@ -34,7 +37,7 @@ require('lspkind').init({
},
})
on_attach = function(client, bufnr)
local on_attach = function(client, bufnr)
function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
@ -76,14 +79,24 @@ on_attach = function(client, bufnr)
]], false)
end
end
--[[-----------------]]--
-- LSP Setup --
--]]-----------------[[--
-- NOTE: Add your LSP configs here.
-- https://github.com/kabouzeid/nvim-lspinstall#advanced-configuration-recommended
local function setup_servers()
-- Provide the missing :LspInstall
require('lspinstall').setup()
local servers = require('lspinstall').installed_servers()
for _, server in pairs(servers) do
nvim_lsp[server].setup{}
end
end
setup_servers()
-- Use a loop to conveniently both setup defined servers
-- and map buffer local keybindings when the language server attaches
servers = { }
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup { on_attach = on_attach }
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
require('lspinstall').post_install_hook = function ()
setup_servers() -- reload installed servers
vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
end

16
lua/plugins.lua

@ -240,14 +240,24 @@ return packer.startup(function()
use {
'hrsh7th/nvim-compe',
requires = {
{'ray-x/lsp_signature.nvim'}, {'onsails/lspkind-nvim'}, {'norcalli/snippets.nvim'}
{'ray-x/lsp_signature.nvim'}, {'onsails/lspkind-nvim'},
{'norcalli/snippets.nvim'}
},
disable = (disabled_completion and true or disabled_compe)
}
-- provides the missing `:LspInstall` for `nvim-lspconfig`.
local disabled_lspinstall = has_value(g.doom_disabled_plugins, 'lspinstall')
if disabled_lsp and (not disabled_lspinstall) then
table.insert(disabled_plugins, 'lspinstall')
nvim_set_var('doom_disabled_plugins', disabled_plugins)
end
use 'kabouzeid/nvim-lspinstall'
-----[[--------------]]-----
--- File Related ---
-----]]--------------[[-----
-- Write / Read files without permissions (e.g. /etc files) without having to use `sudo nvim /path/to/file`
-- Write / Read files without permissions (e.g. /etc files) without having
-- to use `sudo nvim /path/to/file`
local disabled_suda = has_value(g.doom_disabled_plugins, 'suda')
if disabled_files and (not disabled_suda) then
table.insert(disabled_plugins, 'suda')
@ -335,7 +345,7 @@ return packer.startup(function()
'norcalli/nvim-colorizer.lua',
disable = (disabled_web and true or disabled_colorizer)
}
-- HTPP Client support
-- HTTP Client support
-- Depends on bayne/dot-http to work!
local disabled_restclient = has_value(g.doom_disabled_plugins, 'restclient')
if disabled_web and (not disabled_restclient) then

Loading…
Cancel
Save