AutoYADM commit: 2025-07-06 00:55:38

This commit is contained in:
Daniel Fichtinger 2025-07-06 00:55:38 -04:00
parent eec5d16019
commit db3ade3d3b

View file

@ -1,11 +1,14 @@
hook global WinSetOption filetype=python %{ hook global WinSetOption filetype=python %{
# set-option window expandtab true # set-option window expandtab true
# set-option window softtabstop 4 # set-option window softtabstop 4
set-option window formatcmd "ruff format --line-length 74 -" set-option window formatcmd %{
hook -group python-auto-format window BufWritePre .* %{ ruff check --select I --fix --stdin-filename $kak_buffile - 2>/dev/null |
try format ruff format --line-length 74 -
} }
hook -once -always WinSetOption filetype=.* %{ hook -group python-auto-format window BufWritePre .* %{
try format
}
hook -once -always window WinSetOption filetype=.* %{
unset-option window formatcmd unset-option window formatcmd
remove-hooks window python-auto-format remove-hooks window python-auto-format
} }
@ -13,64 +16,64 @@ hook global WinSetOption filetype=python %{
hook global WinSetOption filetype=yaml %{ hook global WinSetOption filetype=yaml %{
set-option window formatcmd %{ set-option window formatcmd %{
if dprint output-resolved-config >/dev/null 2>&1; then if dprint output-resolved-config >/dev/null 2>&1; then
dprint fmt --stdin yaml dprint fmt --stdin yaml
else else
dprint fmt --stdin yaml --config "$HOME/.dprint.jsonc" dprint fmt --stdin yaml --config "$HOME/.dprint.jsonc"
fi fi
} }
} }
hook global WinSetOption filetype=html %{ hook global WinSetOption filetype=html %{
set-option window formatcmd %{ set-option window formatcmd %{
if dprint output-resolved-config >/dev/null 2>&1; then if dprint output-resolved-config >/dev/null 2>&1; then
dprint fmt --stdin html dprint fmt --stdin html
else else
dprint fmt --stdin html --config "$HOME/.dprint.jsonc" dprint fmt --stdin html --config "$HOME/.dprint.jsonc"
fi fi
} }
} }
hook global WinSetOption filetype=css %{ hook global WinSetOption filetype=css %{
set-option window formatcmd %{ set-option window formatcmd %{
if dprint output-resolved-config >/dev/null 2>&1; then if dprint output-resolved-config >/dev/null 2>&1; then
dprint fmt --stdin css dprint fmt --stdin css
else else
dprint fmt --stdin css --config "$HOME/.dprint.jsonc" dprint fmt --stdin css --config "$HOME/.dprint.jsonc"
fi fi
} }
} }
hook global WinSetOption filetype=json %{ hook global WinSetOption filetype=json %{
set-option window formatcmd %{ set-option window formatcmd %{
if dprint output-resolved-config >/dev/null 2>&1; then if dprint output-resolved-config >/dev/null 2>&1; then
dprint fmt --stdin json dprint fmt --stdin json
else else
dprint fmt --stdin json --config "$HOME/.dprint.jsonc" dprint fmt --stdin json --config "$HOME/.dprint.jsonc"
fi fi
} }
} }
hook global WinSetOption filetype=jsonc %{ hook global WinSetOption filetype=jsonc %{
set-option window formatcmd %{ set-option window formatcmd %{
if dprint output-resolved-config >/dev/null 2>&1; then if dprint output-resolved-config >/dev/null 2>&1; then
dprint fmt --stdin jsonc dprint fmt --stdin jsonc
else else
dprint fmt --stdin jsonc --config "$HOME/.dprint.jsonc" dprint fmt --stdin jsonc --config "$HOME/.dprint.jsonc"
fi fi
} }
} }
hook global WinSetOption filetype=toml %{ hook global WinSetOption filetype=toml %{
set-option window formatcmd %{ set-option window formatcmd %{
if dprint output-resolved-config >/dev/null 2>&1; then if dprint output-resolved-config >/dev/null 2>&1; then
dprint fmt --stdin toml dprint fmt --stdin toml
else else
dprint fmt --stdin toml --config "$HOME/.dprint.jsonc" dprint fmt --stdin toml --config "$HOME/.dprint.jsonc"
fi fi
} }
# hook -group toml-auto-format window BufWritePre .* %{ # hook -group toml-auto-format window BufWritePre .* %{
# try format # try format
# } # }
# hook -once -always window WinSetOption filetype=.* %{ # hook -once -always window WinSetOption filetype=.* %{
# unset-option window formatcmd # unset-option window formatcmd
@ -81,9 +84,9 @@ hook global WinSetOption filetype=toml %{
hook global WinSetOption filetype=latex %{ hook global WinSetOption filetype=latex %{
set-option window formatcmd "tex-fmt --stdin" set-option window formatcmd "tex-fmt --stdin"
set-option window autowrap_fmtcmd 'tex-fmt --stdin -l %c' set-option window autowrap_fmtcmd 'tex-fmt --stdin -l %c'
set-option window autowrap_format_paragraph true set-option window autowrap_format_paragraph true
# hook -group latex-auto-format window BufWritePre .* %{ # hook -group latex-auto-format window BufWritePre .* %{
# try format # try format
# } # }
# hook -once -always window WinSetOption filetype=.* %{ # hook -once -always window WinSetOption filetype=.* %{
# unset-option window formatcmd # unset-option window formatcmd
@ -110,15 +113,15 @@ hook global WinSetOption filetype=typst %{
unset-option window formatcmd unset-option window formatcmd
remove-hooks window typst-auto-format remove-hooks window typst-auto-format
} }
define-command -docstring %{ define-command -docstring %{
Spawns a Zathura pdf preview and Typst watcher for the currently open Typst file Spawns a Zathura pdf preview and Typst watcher for the currently open Typst file
} typst %{ } typst %{
nop %sh{ nop %sh{
{ {
"$kak_config/scripts/kak-typ-zathura.fish" -k -w "$kak_buffile" "$kak_client_pid" "$kak_config/scripts/kak-typ-zathura.fish" -k -w "$kak_buffile" "$kak_client_pid"
} > /dev/null 2>&1 < /dev/null & } > /dev/null 2>&1 < /dev/null &
} }
} }
} }
hook global WinSetOption filetype=fish %{ hook global WinSetOption filetype=fish %{
@ -149,45 +152,45 @@ hook global WinSetOption filetype=man %{
} }
hook global WinSetOption filetype=kdl %{ hook global WinSetOption filetype=kdl %{
set-option window formatcmd "kdlfmt format -" set-option window formatcmd "kdlfmt format -"
hook -group kdl-auto-format window BufWritePre .* format hook -group kdl-auto-format window BufWritePre .* format
hook -once -always WinSetOption filetype=.* %{ hook -once -always WinSetOption filetype=.* %{
unset-option window formatcmd unset-option window formatcmd
remove-hooks window kdl-auto-format remove-hooks window kdl-auto-format
} }
} }
hook global WinSetOption filetype=mail %~ hook global WinSetOption filetype=mail %~
evaluate-commands %sh{ evaluate-commands %sh{
# stdin, we assume it's a pager # stdin, we assume it's a pager
if [ "$kak_bufname" = "*stdin*" ]; then if [ "$kak_bufname" = "*stdin*" ]; then
echo 'define-command -hidden ismailreader nop' echo 'define-command -hidden ismailreader nop'
fi fi
} }
try %{ try %{
ismailreader ismailreader
set buffer readonly true set buffer readonly true
try %{ try %{
# remove these highlighters so everything displays properly # remove these highlighters so everything displays properly
remove-highlighter window/number-lines remove-highlighter window/number-lines
remove-highlighter window/show-whitespaces remove-highlighter window/show-whitespaces
ui-wrap-disable ui-wrap-disable
ui-scrolloff-disable ui-scrolloff-disable
} }
} catch %{ } catch %{
set-option window formatcmd 'mailfmt' set-option window formatcmd 'mailfmt'
set-option window comment_line '>' set-option window comment_line '>'
try autospell-enable try autospell-enable
hook -group mail-auto-format window BufWritePre .* format hook -group mail-auto-format window BufWritePre .* format
hook -once -always window WinSetOption filetype=.* %{ hook -once -always window WinSetOption filetype=.* %{
unset-option window formatcmd unset-option window formatcmd
remove-hooks window mail-auto-format remove-hooks window mail-auto-format
} }
} }
~ ~
hook global WinSetOption filetype=ini %{ hook global WinSetOption filetype=ini %{
set-option window comment_line '#' set-option window comment_line '#'
} }
hook global BufCreate .*[.](conf) %{ hook global BufCreate .*[.](conf) %{
@ -195,7 +198,5 @@ hook global BufCreate .*[.](conf) %{
} }
hook global BufCreate .*[.](jinja) %{ hook global BufCreate .*[.](jinja) %{
set-option buffer filetype html set-option buffer filetype html
} }