fix(nvim): add LSP server for autostart

This commit is contained in:
Stefan Imhoff
2022-07-21 18:12:24 +02:00
parent 05ca8a332c
commit a77e11062e
6 changed files with 26 additions and 6 deletions

View File

@@ -114,8 +114,8 @@ cmp.setup({
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "nvim_lsp_signature_help" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
{ name = "dictionary" },

View File

@@ -128,3 +128,6 @@ keymap("o", "il", ":<c-u>normal! $v^<CR>", opts)
keymap("x", "il", ":<c-u>normal! $v^<CR>", opts)
keymap("o", "al", ":<c-u>normal! $v0<CR>", opts)
keymap("x", "al", ":<c-u>normal! $v0<CR>", opts)
-- LSP formatting
keymap("n", "<leader>o", "<cmd>lua vim.lsp.buf.formatting_sync()<CR>", opts)

View File

@@ -7,11 +7,21 @@ local lspconfig = require("lspconfig")
local servers = {
"cssls",
"cssmodules_ls",
"diagnosticls",
"emmet_ls",
"graphql",
"html",
"jsonls",
"pyright",
"remark_ls",
"sourcery",
"stylelint_lsp",
"sumneko_lua",
-- 'tsserver',
"svelte",
"theme_check",
"tsserver",
"vuels",
}
lsp_installer.settings({

View File

@@ -74,9 +74,10 @@ local function lsp_keymaps(bufnr)
end
-- TODO: Neovim 0.8 https://github.com/jose-elias-alvarez/null-ls.nvim/wiki/Avoiding-LSP-formatting-conflicts
-- https://github.com/jose-elias-alvarez/null-ls.nvim/wiki/Formatting-on-save
local lsp_formatting = function(bufnr)
-- vim.lsp.buf.format({})
vim.lsp.buf.formatting({
vim.lsp.buf.formatting_sync({
filter = function(client)
return client.name == "null-ls"
end,
@@ -104,6 +105,11 @@ M.on_attach = function(client, bufnr)
client.resolved_capabilities.document_formatting = false
end
-- Stylelint
if client.name == "stylelint_lsp" then
client.resolved_capabilities.document_formatting = false
end
-- Lua
if client.name == "sumneko_lua" then
client.resolved_capabilities.document_formatting = false

View File

@@ -21,9 +21,10 @@ null_ls.setup({
code_actions.gitsigns,
code_actions.proselint,
completion.luasnip,
completion.spell,
-- completion.spell,
-- diagnostics.codespell,
diagnostics.eslint_d, -- Eslint
diagnostics.eslint, -- Eslint
-- diagnostics.eslint_d, -- Eslint
diagnostics.flake8, -- Python
diagnostics.gitlint,
diagnostics.jsonlint,

View File

@@ -13,8 +13,8 @@ local mappings = {
e = { "<CMD>NvimTreeToggle<CR>", "Explorer" },
f = { "<CMD>FzfLua files<CR>", "Find Files" },
h = { "<CMD>nohlsearch<CR>", "No Highlight" },
j = { "<CMD>b#<CR>", "Toggle Buffers" },
i = { "<CMD>silent !open -a iA\\ Writer.app '%:p'<CR>", "Open in iA Writer" },
j = { "<CMD>b#<CR>", "Toggle Buffers" },
p = { "<CMD>Telescope projects<CR>", "Projects" },
q = { "<CMD>Bdelete!<CR>", "Close Buffer" },
s = {