Skip to content

Commit

Permalink
feat: use yq as YAML formatter (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillmorozov authored Jul 8, 2024
1 parent da282d9 commit 824384c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions neovim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -498,14 +498,12 @@ require("lazy").setup({
},
},
formatters_by_ft = {
go = {
{ "gofumpt", "gofmt" },
},
go = { { "gofumpt", "gofmt" } },
lua = { "stylua" },
python = { "ruff_format" },
sh = { "shfmt" },
terraform = { "terraform_fmt" },
yaml = { "yamlfmt" },
yaml = { { "yamlfmt", "yq" } },
json = { "jq" },
["_"] = { "trim_whitespace" },
},
Expand Down
2 changes: 2 additions & 0 deletions vim/.vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ endif

if executable("yamlfmt")
autocmd FileType yaml setlocal formatprg=yamlfmt\ -formatter\ retain_line_breaks=true\ -in
elseif executable("yq")
autocmd FileType yaml setlocal formatprg=yq\ '.'
endif

if executable("jq")
Expand Down

0 comments on commit 824384c

Please sign in to comment.