2022-02-25 11:48:53 +01:00
|
|
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
|
|
|
call ftplugined#check_undo_ft()
|
|
|
|
|
|
|
|
" Set-up LSP, linters, formatters
|
|
|
|
lua << EOF
|
|
|
|
local null_ls = require("null-ls")
|
2022-02-28 11:31:26 +01:00
|
|
|
local utils = require("ambroisie.utils")
|
|
|
|
|
2022-02-25 11:48:53 +01:00
|
|
|
null_ls.register({
|
|
|
|
null_ls.builtins.diagnostics.shellcheck.with({
|
2022-02-25 13:13:53 +01:00
|
|
|
-- Show error code in message
|
|
|
|
diagnostics_format = "[#{c}] #{m}",
|
2022-02-25 11:48:53 +01:00
|
|
|
-- Require explicit empty string test, use bash dialect
|
|
|
|
extra_args = { "-s", "bash", "-o", "avoid-nullary-conditions" },
|
2022-02-28 11:31:26 +01:00
|
|
|
-- Only used if available
|
|
|
|
condition = utils.is_executable_condition("shellcheck"),
|
2022-02-25 11:48:53 +01:00
|
|
|
}),
|
|
|
|
null_ls.builtins.formatting.shfmt.with({
|
2022-02-25 15:36:31 +01:00
|
|
|
-- 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" },
|
2022-02-28 11:31:26 +01:00
|
|
|
-- Only used if available
|
|
|
|
condition = utils.is_executable_condition("shfmt"),
|
2022-02-25 11:48:53 +01:00
|
|
|
}),
|
|
|
|
})
|
|
|
|
EOF
|