Ⅰ. 插件描述
Vim plugin for hclfmtⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'fatih/vim-hclfmt'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'fatih/vim-hclfmt'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'fatih/vim-hclfmt'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/fatih/vim-hclfmt
Ⅳ. 文档说明
# Archived project. No maintenance.
This project is not maintained anymore and is archived. Feel free to fork and
make your own changes if needed. For more detail read my blog post: Taking an indefinite sabbatical from my projects
Thanks to everyone for their valuable feedback and contributions.
vim-hclfmt
Vim plugin to format Hashicorp Configuration Language (HCL) files, this
format is used by a number of Hashicorp tools, such as Terraform as the
language used for configuration.
The plugin by default will format *.hcl, *.tf and *.nomad files on save.
Under the hood it uses hclfmt to process the
files.

Usage
Save the file or call :HclFmt.
By default vim-hclfmt automatically formats .hcl, .tf and *.nomad files. You can permanently set this configuration in your ~/.vimrc as follows:
let g:hcl_fmt_autosave = 0
let g:tf_fmt_autosave = 0
let g:nomad_fmt_autosave = 0
Install
Vim-hclfmt follows the standard runtime path structure. For Pathogen just clone
the repo. For other plugin managers add the appropriate lines and execute the
plugin's install command.
git clone https://github.com/fatih/vim-hclfmt.git ~/.vim/bundle/vim-hclfmt
Plug 'fatih/vim-hclfmt'
NeoBundle 'fatih/vim-hclfmt'
Plugin 'fatih/vim-hclfmt'
If hclfmt is not already installed:
go get github.com/fatih/hclfmt