Skip to content

Instantly share code, notes, and snippets.

@Phize
Created October 21, 2011 09:11
Show Gist options
  • Save Phize/1303412 to your computer and use it in GitHub Desktop.
Save Phize/1303412 to your computer and use it in GitHub Desktop.
:MakeWith <compiler> command. (コンパイラを一時的に変更して :make するコマンド)
augroup qflist-copen
autocmd!
autocmd vimrc_autocmd QuickfixCmdPost make,grep,grepadd,vimgrep,vimgrepadd,cscope
\ if len(getqflist()) != 0 | copen | endif
augroup END
augroup loclist-lopen
autocmd!
autocmd vimrc_autocmd QuickfixCmdPost lmake,lgrep,lgrepadd,lvimgrep,lvimgrepadd,lcscope
\ if len(getloclist(0)) != 0 | lopen | endif
augroup END
function! s:makeWith(command, compiler)
if exists('g:current_compiler')
let _current_compiler = g:current_compiler
execute 'compiler! ' . a:compiler
execute a:command
execute 'compiler! ' . _current_compiler
unlet _current_compiler
else
execute 'compiler! ' . a:compiler
execute a:command
unlet g:current_compiler
endif
endfunction
command! -bang -bar -nargs=1 MakeWith call s:makeWith('make<bang>', <f-args>)
command! -bang -bar -nargs=1 LMakeWith call s:makeWith('lmake<bang>', <f-args>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment