feat: lsp bindings

This commit is contained in:
aduhayon 2022-08-11 16:09:46 +02:00
parent 78f6db3126
commit fced53c135
6 changed files with 13 additions and 30 deletions

View File

@ -1,5 +1,7 @@
-- packages -- packages
require'lspconfig'.dockerls.setup {} require'lspconfig'.dockerls.setup {
on_attach = require'lspbinds',
}
-- variables -- variables

View File

@ -1,5 +1,7 @@
-- packages -- packages
require'lspconfig'.pyright.setup {} require'lspconfig'.pyright.setup {
on_attach = require'lspbinds',
}
-- variables -- variables
vim.cmd("let g:black_linelength=79") vim.cmd("let g:black_linelength=79")

View File

@ -1,5 +1,7 @@
-- packages -- packages
require'lspconfig'.bashls.setup{} require'lspconfig'.bashls.setup{
on_attach = require'lspbinds',
}
-- variables -- variables

View File

@ -1,5 +1,7 @@
-- packages -- packages
require'lspconfig'.yamlls.setup {} require'lspconfig'.yamlls.setup {
on_attach = require'lspbinds',
}
-- variables -- variables
vim.o.shiftwidth = 2 vim.o.shiftwidth = 2

View File

@ -43,5 +43,3 @@ vim.keymap.set("n", "<C-k>", "<C-w>k" )
vim.keymap.set("n", "<C-l>", "<C-w>l" ) vim.keymap.set("n", "<C-l>", "<C-w>l" )
vim.keymap.set("n", "gf", "gF" ) vim.keymap.set("n", "gf", "gF" )
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)

View File

@ -6,9 +6,7 @@ vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts) vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
-- Use an on_attach function to only map the following keys return function(client, bufnr)
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o> -- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
@ -31,24 +29,3 @@ local on_attach = function(client, bufnr)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts) vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts)
end end
local lsp_flags = {
-- This is the default in Nvim 0.7+
debounce_text_changes = 150,
}
require('lspconfig')['pyright'].setup{
on_attach = on_attach,
flags = lsp_flags,
}
require('lspconfig')['tsserver'].setup{
on_attach = on_attach,
flags = lsp_flags,
}
require('lspconfig')['rust_analyzer'].setup{
on_attach = on_attach,
flags = lsp_flags,
-- Server-specific settings...
settings = {
["rust-analyzer"] = {}
}
}