diff --git a/plugin/rubocop.vim b/plugin/rubocop.vim index 2d98d4e..830d652 100644 --- a/plugin/rubocop.vim +++ b/plugin/rubocop.vim @@ -15,23 +15,6 @@ let g:loaded_vimrubocop = 1 let s:save_cpo = &cpo set cpo&vim -if !exists('g:vimrubocop_rubocop_cmd') - let g:vimrubocop_rubocop_cmd = 'rubocop ' -endif - -" Options -if !exists('g:vimrubocop_config') - let g:vimrubocop_config = '' -endif - -if !exists('g:vimrubocop_extra_args') - let g:vimrubocop_extra_args = '' -endif - -if !exists('g:vimrubocop_keymap') - let g:vimrubocop_keymap = 1 -endif - let s:rubocop_switches = ['-l', '--lint', '-R', '--rails', '-a', '--auto-correct'] function! s:RuboCopSwitches(...) @@ -39,11 +22,11 @@ function! s:RuboCopSwitches(...) endfunction function! s:RuboCop(current_args) - let l:extra_args = g:vimrubocop_extra_args + let l:extra_args = get(g:, 'vimrubocop_extra_args', '') let l:filename = @% - let l:rubocop_cmd = g:vimrubocop_rubocop_cmd + let l:rubocop_cmd = get(g:, 'vimrubocop_rubocop_cmd', 'rubocop ') let l:rubocop_opts = ' '.a:current_args.' '.l:extra_args.' --format emacs' - if g:vimrubocop_config != '' + if get(g:, 'vimrubocop_config', '') != '' let l:rubocop_opts = ' '.l:rubocop_opts.' --config '.g:vimrubocop_config endif @@ -71,7 +54,7 @@ endfunction command! -complete=custom,s:RuboCopSwitches -nargs=? RuboCop :call RuboCop() " Shortcuts for RuboCop -if g:vimrubocop_keymap == 1 +if get(g:, 'vimrubocop_keymap', !exists('no_plugin_maps')) nmap ru :RuboCop endif