diff --git a/plugin/rubocop.vim b/plugin/rubocop.vim index 2d98d4e..1147ed3 100644 --- a/plugin/rubocop.vim +++ b/plugin/rubocop.vim @@ -54,18 +54,22 @@ function! s:RuboCop(current_args) endif let l:rubocop_output = substitute(l:rubocop_output, '\\"', "'", 'g') let l:rubocop_results = split(l:rubocop_output, "\n") - cexpr l:rubocop_results - copen - " Shortcuts taken from Ack.vim - git://github.com/mileszs/ack.vim.git - exec "nnoremap q :ccl" - exec "nnoremap t T" - exec "nnoremap T TgT" - exec "nnoremap o " - exec "nnoremap go " - exec "nnoremap h K" - exec "nnoremap H Kb" - exec "nnoremap v HbJt" - exec "nnoremap gv HbJ" + + if !empty(l:rubocop_results) + cexpr l:rubocop_results + copen + + " Shortcuts taken from Ack.vim - git://github.com/mileszs/ack.vim.git + exec "nnoremap q :ccl" + exec "nnoremap t T" + exec "nnoremap T TgT" + exec "nnoremap o " + exec "nnoremap go " + exec "nnoremap h K" + exec "nnoremap H Kb" + exec "nnoremap v HbJt" + exec "nnoremap gv HbJ" + endif endfunction command! -complete=custom,s:RuboCopSwitches -nargs=? RuboCop :call RuboCop()