hashivim / vim-terraform

basic vim/terraform integration
http://hashivim.github.io/vim-terraform
ISC License
1.07k stars 111 forks source link

Add ability to autoformat hcl files on save #165

Closed jmreicha closed 3 years ago

jmreicha commented 3 years ago

It would be nice to have have the ability to automatically format hcl files as part of the g:terraform_fmt_on_save = 1 functionality. Right now I have some extra configuration in my vimrc file but was surprised at how long it took to figure out as I somewhat expected the format these file on save.

Here's the extra config if anyone finds it useful.

autocmd BufWritePre *.hcl call terraform#fmt()
dimbleby commented 3 years ago

https://github.com/hashivim/vim-terraform#use-with-other-hcl-files

which is to say that I'm not in general looking to expand this plugin to be more widely scoped than terraform. But would accept an MR noting the above in that section of the README.

jmreicha commented 3 years ago

Got it, thanks. I'll throw something in there!