lsp fixes

This commit is contained in:
Ivan Dimitrov 2023-07-15 18:27:18 +03:00
parent 89c239667a
commit 8c16d2cb6f
3 changed files with 23 additions and 13 deletions

View File

@ -1,3 +1,4 @@
-- START GLOBAL CONFIG
vim.wo.number = true -- show numbers
vim.o.scrolloff = 15 -- scrll if n lines left
vim.o.hlsearch = false -- highlight search
@ -21,23 +22,31 @@ nmap("<leader>fw", require("telescope.builtin").live_grep)
nmap("<leader>e", vim.diagnostic.open_float)
-- END GLOBAL CONFIG
-- START LSP
local cmp = require("cmp")
local lspconfig = require("lspconfig")
local servers = {
tsserver = {},
tsserver = {
settings = {
completions = {
completeFunctionCalls = true
}
}
},
pylsp = {},
lua_ls = {},
rnix = {},
eslint = {
cmd = { "eslint", "--stdin", "--stdin-filename", "%:p" }
}
gopls = {}
}
local cmp_capabilities = require("cmp_nvim_lsp").default_capabilities()
local on_attach = function(_, bufnr)
local on_attach = function(client, bufnr)
nmap("<leader>ca", vim.lsp.buf.code_action)
nmap('<leader>l', function() vim.lsp.buf.format() end)
nmap("<leader>l", function()
vim.lsp.buf.format()
end)
nmap("K", vim.lsp.buf.hover)
nmap("gr", require("telescope.builtin").lsp_references)
end
@ -56,8 +65,7 @@ cmp.setup({
for server, cfg in pairs(servers) do
lspconfig[server].setup({
cmd = cfg.cmd,
settings = cfg.settings,
cfg,
capabilities = cmp_capabilities,
on_attach = on_attach,
})

View File

@ -55,14 +55,15 @@
grim
home-manager
jmtpfs
jq
libgccjit
libmtp
lolcat
mako
mlocate
mupdf
nodejs_20
nodePackages_latest.pnpm
nodejs_20
pinentry-qt
piper
rustup

View File

@ -47,7 +47,8 @@
enable = true;
viAlias = true;
extraPackages = with pkgs; [
nodePackages_latest.eslint
go
gopls
nodePackages_latest.prettier
nodePackages_latest.typescript
nodePackages_latest.typescript-language-server