aboutsummaryrefslogtreecommitdiff
path: root/autoload/formatter.kak
blob: 60126047011162876157355d8c1c546d10f91260 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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{
    echo "set-option buffer formatcmd %{rubocop -x --stderr -s '$kak_buffile'}"
  }
}