Skip to content

Instantly share code, notes, and snippets.

@eagletmt
Created May 11, 2010 07:44
Show Gist options
  • Save eagletmt/397027 to your computer and use it in GitHub Desktop.
Save eagletmt/397027 to your computer and use it in GitHub Desktop.
command! -nargs=0 CompileThis call s:compile_this()
let s:compile_cmd = {
\ 'c': 'gcc -c -Wall',
\ 'cpp': 'g++ -c -Wall -std=c++0x',
\ 'haskell': 'ghc -c -Wall'
\ }
function! s:compile_this()
if !has_key(s:compile_cmd, &l:filetype)
echoerr "I don't know how to compile"
return
endif
let save = &l:makeprg
let &l:makeprg = s:compile_cmd[&l:filetype]
execute 'make ' . expand('%:p')
let &l:makeprg = save
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment