Compare commits
2 commits
747b344b76
...
322fbc970b
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | 322fbc970b | ||
Bruno BELANYI | 92e5fbe7df |
|
@ -74,6 +74,16 @@ if utils.is_executable("bash-language-server") then
|
|||
filetypes = { "bash", "sh", "zsh" },
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp.on_attach,
|
||||
settings = {
|
||||
bashIde = {
|
||||
shfmt = {
|
||||
-- Simplify the code
|
||||
simplifyCode = true,
|
||||
-- Indent switch cases
|
||||
caseIndent = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -46,29 +46,3 @@ null_ls.register({
|
|||
condition = utils.is_executable_condition("isort"),
|
||||
}),
|
||||
})
|
||||
|
||||
-- Shell (non-POSIX)
|
||||
null_ls.register({
|
||||
null_ls.builtins.formatting.shfmt.with({
|
||||
-- Indent with 4 spaces, simplify the code, indent switch cases,
|
||||
-- add space after redirection, use bash dialect
|
||||
extra_args = { "-i", "4", "-s", "-ci", "-sr", "-ln", "bash" },
|
||||
-- Restrict to bash and zsh
|
||||
filetypes = { "bash", "zsh" },
|
||||
-- Only used if available
|
||||
condition = utils.is_executable_condition("shfmt"),
|
||||
}),
|
||||
})
|
||||
|
||||
-- Shell (POSIX)
|
||||
null_ls.register({
|
||||
null_ls.builtins.formatting.shfmt.with({
|
||||
-- Indent with 4 spaces, simplify the code, indent switch cases,
|
||||
-- add space after redirection, use POSIX
|
||||
extra_args = { "-i", "4", "-s", "-ci", "-sr", "-ln", "posix" },
|
||||
-- Restrict to POSIX sh
|
||||
filetypes = { "sh" },
|
||||
-- Only used if available
|
||||
condition = utils.is_executable_condition("shfmt"),
|
||||
}),
|
||||
})
|
||||
|
|
4
overlays/lsp-format-nvim-indentation/default.nix
Normal file
4
overlays/lsp-format-nvim-indentation/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
self: prev:
|
||||
{
|
||||
vimPlugins = prev.vimPlugins.extend (self.callPackage ./generated.nix { });
|
||||
}
|
14
overlays/lsp-format-nvim-indentation/generated.nix
Normal file
14
overlays/lsp-format-nvim-indentation/generated.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ fetchpatch, ... }:
|
||||
|
||||
_final: prev: {
|
||||
lsp-format-nvim = prev.lsp-format-nvim.overrideAttrs (oa: {
|
||||
patches = (oa.patches or [ ]) ++ [
|
||||
# https://github.com/lukas-reineke/lsp-format.nvim/issues/94
|
||||
(fetchpatch {
|
||||
name = "use-effective-indentation";
|
||||
url = "https://github.com/liskin/lsp-format.nvim/commit/3757ac443bdf5bd166673833794553229ee8d939.patch";
|
||||
hash = "sha256-Dv+TvXrU/IrrPxz2MSPbLmRxch+qkHbI3AyFMj/ssDk=";
|
||||
})
|
||||
];
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue