nix-config/config/neovim/lua/opdavies/lsp/init.lua
Oliver Davies 000bb2fd5e revert(nvim): add mappings for cnext and cprev
Removing these keymaps as they conflict with C-j and C-k which navigates
between horizontal splits in tmux.

I also already have `]q`, `[q`, `]l` and `[l` that do the same `cnext`
and `lnext` navigation.

This reverts commit a02e2765f4.
2023-07-28 09:02:15 +01:00

85 lines
1.4 KiB
Lua

local cmp = require('cmp')
local lsp = require('lsp-zero')
local lspconfig = require('lspconfig')
lsp.preset("recommended")
local on_attach = function(client, bufnr)
lsp.default_keymaps({buffer = bufnr})
local opts = { buffer = true }
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
vim.keymap.set("n", "<leader>ca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>f", function() vim.lsp.buf.format({ async = true }) end, opts)
vim.keymap.set("n", "<leader>rn", function() vim.lsp.buf.rename() end, opts)
end
lsp.on_attach(on_attach)
lsp.set_preferences({
sign_icons = {},
})
lsp.setup_servers({
'ansiblels',
'astro',
'bashls',
'cssls',
'dockerls',
'html',
'jsonls',
'nixd',
'phpactor',
'tailwindcss',
'terraformls',
'tsserver',
'volar',
'vuels',
'yamlls'
})
lsp.setup()
lspconfig.tailwindcss.setup({
on_attach = on_attach,
filetypes = {
"astro",
"html",
"html.twig",
"javascript",
"php",
"twig",
"typescript",
"vue",
},
init_options = {
userLanguages = {
["html.twig"] = "html",
},
},
})
lspconfig.yamlls.setup({
settings = {
yaml = {
keyOrdering = false,
}
}
})
vim.diagnostic.config({
virtual_text = true,
})
cmp.setup({
preselect = 'item',
completion = {
completeopt = 'menu,menuone,noinsert'
},
})
require "opdavies.lsp.null-ls"
require "opdavies.lsp.signature"