Skip to content

Commit c821b66

Browse files
Ralph7C2smile13241324
authored andcommitted
Add shell-scripts-shfmt-args variable
This adds a variable to the `shell-scripts` layer to allow passing arguments through to the `shfmt` package.
1 parent b9a52cc commit c821b66

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.develop

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ In org-agenda-mode
349349
- Add ~o~ to link-hint-open-link in woman-mode
350350
***** Shaders
351351
- =shaders= layer has been moved to =gpu= layer.
352+
***** Shell-scripts
353+
- Add variable =shell-scripts-shfmt-args= to pass through arguments to =shfmt= package.
352354
***** Syntax checking
353355
- Key bindings (thanks to Loris Lucido):
354356
- Key binding ~SPC e e~ is now for triggering a syntax check, the old action

layers/+lang/shell-scripts/config.el

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ When `lsp' layer is used, defaults to `lsp'.")
3131

3232
(defvar shell-scripts-format-on-save nil
3333
"If non-nil, automatically format code with shfmt on save.")
34+
35+
(defcustom shell-scripts-shfmt-args ()
36+
"Arguments passed to shfmt."
37+
:type '(list string))

layers/+lang/shell-scripts/packages.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@
110110
;; therefore bind this function to "==" instead
111111
(if (eq shell-scripts-backend 'lsp)
112112
(spacemacs/set-leader-keys-for-major-mode 'sh-mode "==" 'shfmt-buffer)
113-
(spacemacs/set-leader-keys-for-major-mode 'sh-mode "=" 'shfmt-buffer))))
113+
(spacemacs/set-leader-keys-for-major-mode 'sh-mode "=" 'shfmt-buffer))
114+
:config
115+
(when shell-scripts-shfmt-args
116+
(setq shfmt-arguments shell-scripts-shfmt-args))))
114117

115118
(defun shell-scripts/post-init-ggtags ()
116119
(add-hook 'sh-mode-local-vars-hook #'spacemacs/ggtags-mode-enable))

0 commit comments

Comments
 (0)