AutoYADM commit: 2025-06-24 13:51:47

This commit is contained in:
Daniel Fichtinger 2025-06-24 13:51:47 -04:00
parent 2cf674bb7e
commit 6264b1e53c
4 changed files with 77 additions and 15 deletions

View file

@ -11,8 +11,64 @@ hook global WinSetOption filetype=python %{
}
}
hook global WinSetOption filetype=yaml %{
set-option window formatcmd %{
if dprint output-resolved-config >/dev/null 2>&1; then
dprint fmt --stdin yaml
else
dprint fmt --stdin yaml --config "$HOME/.dprint.jsonc"
fi
}
}
hook global WinSetOption filetype=html %{
set-option window formatcmd %{
if dprint output-resolved-config >/dev/null 2>&1; then
dprint fmt --stdin html
else
dprint fmt --stdin html --config "$HOME/.dprint.jsonc"
fi
}
}
hook global WinSetOption filetype=css %{
set-option window formatcmd %{
if dprint output-resolved-config >/dev/null 2>&1; then
dprint fmt --stdin css
else
dprint fmt --stdin css --config "$HOME/.dprint.jsonc"
fi
}
}
hook global WinSetOption filetype=json %{
set-option window formatcmd %{
if dprint output-resolved-config >/dev/null 2>&1; then
dprint fmt --stdin json
else
dprint fmt --stdin json --config "$HOME/.dprint.jsonc"
fi
}
}
hook global WinSetOption filetype=jsonc %{
set-option window formatcmd %{
if dprint output-resolved-config >/dev/null 2>&1; then
dprint fmt --stdin jsonc
else
dprint fmt --stdin jsonc --config "$HOME/.dprint.jsonc"
fi
}
}
hook global WinSetOption filetype=toml %{
set-option window formatcmd "taplo fmt -"
set-option window formatcmd %{
if dprint output-resolved-config >/dev/null 2>&1; then
dprint fmt --stdin toml
else
dprint fmt --stdin toml --config "$HOME/.dprint.jsonc"
fi
}
# hook -group toml-auto-format window BufWritePre .* %{
# try format
# }

View file

@ -1,11 +1,14 @@
hook global WinSetOption filetype=markdown %{
# explicitly load to avoid race condition
require-module markdown
# set-option window formatcmd "dprint fmt --stdin md"
set-option window formatcmd %{
dprint fmt --stdin md || dprint fmt --stdin md --config '/home/fic/.dprint.jsonc' -L info
if dprint output-resolved-config >/dev/null 2>&1; then
dprint fmt --stdin md
else
dprint fmt --stdin md --config "$HOME/.dprint.jsonc"
fi
}
hook -group markdown-auto-format window BufWritePre .* format
hook -group markdown-auto-format window BufWritePre .* { format }
# override formatting commands
define-command -override -hidden markdown-trim-indent %{