Add `shell-scripts-shfmt-args` variable

This adds a variable to the `shell-scripts` layer to allow passing
arguments through to the `shfmt` package.
This commit is contained in:
Ralph Landon 2022-10-19 10:13:19 -05:00 committed by Maxi Wolff
parent b9a52ccad3
commit c821b660c3
3 changed files with 10 additions and 1 deletions

View File

@ -349,6 +349,8 @@ In org-agenda-mode
- Add ~o~ to link-hint-open-link in woman-mode
***** Shaders
- =shaders= layer has been moved to =gpu= layer.
***** Shell-scripts
- Add variable =shell-scripts-shfmt-args= to pass through arguments to =shfmt= package.
***** Syntax checking
- Key bindings (thanks to Loris Lucido):
- Key binding ~SPC e e~ is now for triggering a syntax check, the old action

View File

@ -31,3 +31,7 @@ When `lsp' layer is used, defaults to `lsp'.")
(defvar shell-scripts-format-on-save nil
"If non-nil, automatically format code with shfmt on save.")
(defcustom shell-scripts-shfmt-args ()
"Arguments passed to shfmt."
:type '(list string))

View File

@ -110,7 +110,10 @@
;; therefore bind this function to "==" instead
(if (eq shell-scripts-backend 'lsp)
(spacemacs/set-leader-keys-for-major-mode 'sh-mode "==" 'shfmt-buffer)
(spacemacs/set-leader-keys-for-major-mode 'sh-mode "=" 'shfmt-buffer))))
(spacemacs/set-leader-keys-for-major-mode 'sh-mode "=" 'shfmt-buffer))
:config
(when shell-scripts-shfmt-args
(setq shfmt-arguments shell-scripts-shfmt-args))))
(defun shell-scripts/post-init-ggtags ()
(add-hook 'sh-mode-local-vars-hook #'spacemacs/ggtags-mode-enable))