From 58470804d69b87df91e15a20d9b640cf9829a8d8 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 25 Feb 2022 11:49:03 +0100 Subject: [PATCH] home: vim: configure 'null-ls' for 'sh' --- home/vim/after/ftplugin/sh.vim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 home/vim/after/ftplugin/sh.vim diff --git a/home/vim/after/ftplugin/sh.vim b/home/vim/after/ftplugin/sh.vim new file mode 100644 index 0000000..8d1594b --- /dev/null +++ b/home/vim/after/ftplugin/sh.vim @@ -0,0 +1,17 @@ +" 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") +null_ls.register({ + null_ls.builtins.diagnostics.shellcheck.with({ + -- Require explicit empty string test + extra_args = { "-o", "avoid-nullary-conditions" }, + }), + null_ls.builtins.formatting.shfmt.with({ + -- Indent with 4 spaces, simplify the code, indent switch cases, use POSIX + extra_args = { "-i", "4", "-s", "-ci", "-ln", "posix" }, + }), +}) +EOF