diff options
Diffstat (limited to '')
| -rw-r--r-- | autoload/formatter.kak | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/autoload/formatter.kak b/autoload/formatter.kak new file mode 100644 index 0000000..741e9e8 --- /dev/null +++ b/autoload/formatter.kak @@ -0,0 +1,19 @@ +# TODO: Use a single hook? +hook global BufSetOption filetype=json %{ set-option buffer formatcmd "jq" } +hook global BufSetOption filetype=fennel %{ set-option buffer formatcmd "fnlfmt -" } +hook global BufSetOption filetype=nix %{ set-option buffer formatcmd "nixfmt -" } +hook global BufSetOption filetype=(?:javascript|typescript) %{ + evaluate-commands %sh{ + if [ -f "$PWD/biome.json" ]; then + echo "set-option buffer formatcmd %{npx biome check --fix --stdin-file-path=$kak_buffile 2>/dev/null}" + fi + } +} +hook global BufSetOption filetype=(?:ruby) %{ + evaluate-commands %sh{ + if [ -f "$PWD/.rubocop.yml" ]; then + echo "set-option buffer formatcmd %{rubocop -x --stderr -s '$kak_buffile'}" + fi + } +} + |
