diff --git a/home/neovim.nix b/home/neovim.nix index 2403bc6c..d7528df4 100644 --- a/home/neovim.nix +++ b/home/neovim.nix @@ -245,21 +245,25 @@ in config = /* lua */ '' local lspconfig = require('lspconfig') local capabilities = require("cmp_nvim_lsp").default_capabilities() + lspconfig.denols.setup { capabilities = capabilities, root_dir = lspconfig.util.root_pattern("deno.json", "deno.jsonc"), } + lspconfig.tsserver.setup { capabilities = capabilities, root_dir = lspconfig.util.root_pattern("package.json"), single_file_support = false } + lspconfig.typst_lsp.setup { capabilities = capabilities, settings = { exportPdf = "onSave" } } + lspconfig.eslint.setup { capabilities = capabilities, on_attach = function(client, bufnr) @@ -269,20 +273,25 @@ in }) end } + lspconfig.tailwindcss.setup { capabilities = capabilities, on_attach = function(client, bufnr) require("tailwindcss-colors").buf_attach(bufnr) end } + vim.keymap.set('n', 'e', vim.diagnostic.open_float) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) vim.keymap.set('n', ']d', vim.diagnostic.goto_next) vim.keymap.set('n', 'q', vim.diagnostic.setloclist) + vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) local opts = { buffer = ev.buf } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)