Ⅰ. 插件描述
Vim plugin for cockroachdb/crlfmtⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'irfansharif/vim-crlfmt'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'irfansharif/vim-crlfmt'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'irfansharif/vim-crlfmt'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/irfansharif/vim-crlfmt
Ⅳ. 文档说明
# vim-crlfmt
Vim plugin for crlfmt, a gofmt-style linter for Go code that enforces the
CockroachDB Style Guide found
here. Heavily
borrowed implementation from fatih/vim-go
and fatih/vim-hclfmt.
The plugin by default will format *.go files on save, ignoring *.pb.go and*.pb.gw.go. Under the hood it uses
crlfmt to process the files.
Usage
Save the file or call :Crlfmt.
By default vim-crlfmt automatically formats .go files, ignoring .pb.go and
*.pb.gw.go files, tab width for column calculations used is 2.
" Turn off autosave formatting
g:crlfmt_autosave = 0 [default = 1]
" Options to pass to crlfmt
g:crlfmt_options = '' [default = '-ignore ".*.pb(.gw)?.go -tab 2"']
" Don't display error message if crlfmt fails
g:crlfmt_fail_silently = 1 [default = 0]Install
Vim-crlfmt 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.