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.
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]
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.