feat(nvim): add null ls

dev-docs
Moritz Böhme 2023-04-10 01:05:25 +02:00
parent e154f827fd
commit 7b9674969a
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
2 changed files with 61 additions and 0 deletions

View File

@ -49,14 +49,17 @@ in
extraPackages = with pkgs; [
alejandra
black
deadnix
isort
jq
nil
nixpkgs-fmt
nodePackages.bash-language-server
nodePackages.cspell
rustfmt
shellcheck
shfmt
statix
stylua
sumneko-lua-language-server
taplo

View File

@ -0,0 +1,58 @@
local null_ls = require("null-ls")
null_ls.setup({
sources = {
-- Code actions
null_ls.builtins.code_actions.cspell,
null_ls.builtins.code_actions.gitsigns,
null_ls.builtins.code_actions.shellcheck,
null_ls.builtins.code_actions.statix,
-- Completion
null_ls.builtins.completion.spell,
-- Diagnostics
null_ls.builtins.diagnostics.cspell,
null_ls.builtins.diagnostics.deadnix,
null_ls.builtins.diagnostics.shellcheck,
null_ls.builtins.diagnostics.statix,
},
})
-- disable cspell initially
null_ls.disable("cspell")
-- make sources toggle able
require("which-key").register({
n = {
name = "null-ls",
c = {
function()
null_ls.toggle("cspell")
end,
"cspell",
},
g = {
function()
null_ls.toggle("gitsigns")
end,
"gitsigns",
},
s = {
function()
null_ls.toggle("shellcheck")
end,
"shellcheck",
},
S = {
function()
null_ls.toggle("statix")
end,
"statix",
},
d = {
function()
null_ls.toggle("deadnix")
end,
"deadnix",
},
},
}, { prefix = "<leader>t" })