feat(nvim): add null ls

nixos
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; [ extraPackages = with pkgs; [
alejandra alejandra
black black
deadnix
isort isort
jq jq
nil nil
nixpkgs-fmt nixpkgs-fmt
nodePackages.bash-language-server nodePackages.bash-language-server
nodePackages.cspell
rustfmt rustfmt
shellcheck shellcheck
shfmt shfmt
statix
stylua stylua
sumneko-lua-language-server sumneko-lua-language-server
taplo 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" })