refactor(format): replace with apheleia
Initial refactor of format module to replace format-all with apheleia
This commit is contained in:
parent
a44e8d6bfd
commit
4ecd616cd8
9 changed files with 126 additions and 585 deletions
|
@ -107,8 +107,6 @@
|
|||
:commands ocamlformat
|
||||
:hook (tuareg-mode-local-vars . +ocaml-init-ocamlformat-h)
|
||||
:config
|
||||
(set-formatter! 'ocamlformat #'ocamlformat
|
||||
:modes '(caml-mode tuareg-mode))
|
||||
;; TODO Fix region-based formatting support
|
||||
(defun +ocaml-init-ocamlformat-h ()
|
||||
(setq +format-with 'ocp-indent)
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
(set-docsets! 'php-mode "PHP" "PHPUnit" "Laravel" "CakePHP" "CodeIgniter" "Doctrine_ORM")
|
||||
(set-repl-handler! 'php-mode #'+php/open-repl)
|
||||
(set-lookup-handlers! 'php-mode :documentation #'php-search-documentation)
|
||||
(set-formatter! 'php-mode #'php-cs-fixer-fix)
|
||||
(set-ligatures! 'php-mode
|
||||
;; Functional
|
||||
:lambda "function()" :lambda "fn"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -27,15 +27,15 @@
|
|||
|
||||
;; tidy is already defined by the format-all package. We redefine it to add
|
||||
;; more sensible arguments to the tidy command.
|
||||
(set-formatter! 'html-tidy
|
||||
'("tidy" "-q" "-indent"
|
||||
"--tidy-mark" "no"
|
||||
"--drop-empty-elements" "no"
|
||||
("--show-body-only" "%s" (if +format-region-p "true" "auto"))
|
||||
("--indent-spaces" "%d" tab-width)
|
||||
("--indent-with-tabs" "%s" (if indent-tabs-mode "yes" "no"))
|
||||
("-xml" (memq major-mode '(nxml-mode xml-mode))))
|
||||
:ok-statuses '(0 1))
|
||||
;; (set-formatter! 'html-tidy
|
||||
;; '("tidy" "-q" "-indent"
|
||||
;; "--tidy-mark" "no"
|
||||
;; "--drop-empty-elements" "no"
|
||||
;; ("--show-body-only" "%s" (if +format-region-p "true" "auto"))
|
||||
;; ("--indent-spaces" "%d" tab-width)
|
||||
;; ("--indent-with-tabs" "%s" (if indent-tabs-mode "yes" "no"))
|
||||
;; ("-xml" (memq major-mode '(nxml-mode xml-mode))))
|
||||
;; :ok-statuses '(0 1))
|
||||
|
||||
(setq web-mode-enable-html-entities-fontification t
|
||||
web-mode-auto-close-style 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue