refactor(format): replace with apheleia

Initial refactor of format module to replace format-all with apheleia
This commit is contained in:
Ellis Kenyő 2022-08-16 08:13:55 +01:00 committed by Ellis Kenyo
parent a44e8d6bfd
commit 4ecd616cd8
No known key found for this signature in database
GPG key ID: 298BE5D997EBAA02
9 changed files with 126 additions and 585 deletions

View file

@ -17,10 +17,13 @@
:config
(set-docsets! 'sh-mode "Bash")
(set-electric! 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;"))
(set-formatter! 'shfmt
'("shfmt" "-ci"
("-i" "%d" (unless indent-tabs-mode tab-width))
("-ln" "%s" (pcase sh-shell (`bash "bash") (`mksh "mksh") (_ "posix")))))
(after! apheleia
(setf (alist-get 'shfmt apheleia-formatters)
'("shfmt" "-ci"
(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-lookup-handlers! 'sh-mode :documentation #'+sh-lookup-documentation-handler)
(set-ligatures! 'sh-mode
@ -85,10 +88,6 @@
;; whatis lookups are exceptionally slow on macOS (#5860)
company-shell-dont-fetch-meta IS-MAC))
(use-package! fish-mode
:when (modulep! +fish)
:defer t
:config (set-formatter! 'fish-mode #'fish_indent))
(use-package! powershell
:when (modulep! +powershell)