fix(format): correctly adjust shfmt

This commit is contained in:
Ellis Kenyő 2022-06-20 08:57:34 +01:00 committed by Ellis Kenyo
parent 4ecd616cd8
commit 115bfc52a2
No known key found for this signature in database
GPG key ID: 298BE5D997EBAA02

View file

@ -17,12 +17,9 @@
:config :config
(set-docsets! 'sh-mode "Bash") (set-docsets! 'sh-mode "Bash")
(set-electric! 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;")) (set-electric! 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;"))
(after! apheleia (set-formatter! 'shfmt '("shfmt" "-ci"
(setf (alist-get 'shfmt apheleia-formatters) (unless indent-tabs-mode
'("shfmt" "-ci" (list "-i" (number-to-string tab-width)))))
(unless indent-tabs-mode
(list "-i" (number-to-string tab-width)))
(list "-ln" (pcase sh-shell (`bash "bash") (`mksh "mksh") (_ "posix"))))))
(set-repl-handler! 'sh-mode #'+sh/open-repl) (set-repl-handler! 'sh-mode #'+sh/open-repl)
(set-lookup-handlers! 'sh-mode :documentation #'+sh-lookup-documentation-handler) (set-lookup-handlers! 'sh-mode :documentation #'+sh-lookup-documentation-handler)