From cffce11a85b871329cf20a28914b4a3983cd58fb Mon Sep 17 00:00:00 2001 From: Clayton Parker Date: Fri, 13 Jan 2017 11:20:06 -0500 Subject: [PATCH] add rubocop formatter --- README.md | 4 ++++ plugin/defaults.vim | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3dca426..b2f9229 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,10 @@ Here is a list of formatprograms that are supported by default, and thus will be Here is the link to the repository: https://github.com/erniebrodeur/ruby-beautify. This beautifier developed and tested with ruby `2.0+`, so you can have weird results with earlier ruby versions. +* `rubocop` for __Ruby__. + It can be installed by running `gem install rubocop`. + Here is the link to the repository: https://github.com/bbatsov/rubocop + * `gofmt` for __Golang__. The default golang formatting program is shipped with the golang distribution. Make sure `gofmt` is in your PATH (if golang is installed properly, it should be). Here is the link to the installation: https://golang.org/doc/install diff --git a/plugin/defaults.vim b/plugin/defaults.vim index 7d707c0..abb4c61 100644 --- a/plugin/defaults.vim +++ b/plugin/defaults.vim @@ -233,8 +233,14 @@ if !exists('g:formatdef_rbeautify') let g:formatdef_rbeautify = '"rbeautify ".(&expandtab ? "-s -c ".shiftwidth() : "-t")' endif +if !exists('g:formatdef_rubocop') + " The pipe to sed is required to remove some rubocop output that could not + " be suppressed. + let g:formatdef_rubocop = "'rubocop --auto-correct -o /dev/null -s '.bufname('%').' \| sed -n 2,\\$p'" +endif + if !exists('g:formatters_ruby') - let g:formatters_ruby = ['rbeautify'] + let g:formatters_ruby = ['rbeautify', 'rubocop'] endif