From 405080b22d96c426c1185d02c9469a560dbe429c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Tue, 5 Mar 2024 22:33:29 +0100 Subject: [PATCH] Add lsp for .nix --- home/editor/neovim/plugins.lua | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/home/editor/neovim/plugins.lua b/home/editor/neovim/plugins.lua index dfbe7e5..0bfc100 100644 --- a/home/editor/neovim/plugins.lua +++ b/home/editor/neovim/plugins.lua @@ -7,7 +7,19 @@ lsp_zero.on_attach(function(client, bufnr) lsp_zero.default_keymaps({buffer = bufnr}) end) -require('lspconfig').gopls.setup({ +lsp_zero.format_on_save({ + format_opts = { + async = false, + timeout_ms = 10000, + }, + servers = { + ['gopls'] = {'go'}, + ['nil_ls'] = {'nix'}, + }, +}) + +local lspconfig = require('lspconfig') +lspconfig.gopls.setup({ settings = { gopls = { analyses = { @@ -19,6 +31,17 @@ require('lspconfig').gopls.setup({ } }) +lspconfig.nil_ls.setup({ + autostart = true, + settings = { + ['nil'] = { + formatting = { + command = { "nixpkgs-fmt" }, + }, + }, + }, +}) + -- Telescope require('telescope').setup({