Skip to content

Instantly share code, notes, and snippets.

@DeaR DeaR/quickrun_config.vim
Last active Jan 15, 2020

Embed
What would you like to do?
if has('win32') || has('win64')
let s:save_ssl = &shellslash
set noshellslash
if exists('$VS110COMNTOOLS')
let s:vcvarsall_bat = shellescape($VS110COMNTOOLS . '..\..\VC\vcvarsall.bat')
elseif exists('$VS100COMNTOOLS')
let s:vcvarsall_bat = shellescape($VS100COMNTOOLS . '..\..\VC\vcvarsall.bat')
elseif exists('$VS90COMNTOOLS')
let s:vcvarsall_bat = shellescape($VS90COMNTOOLS . '..\..\VC\vcvarsall.bat')
elseif exists('$VS80COMNTOOLS')
let s:vcvarsall_bat = shellescape($VS80COMNTOOLS . '..\..\VC\vcvarsall.bat')
endif
let &shellslash = s:save_ssl
unlet s:save_ssl
endif
if exists('s:vcvarsall_bat')
let s:hook = {
\ 'name' : 'vcvarsall',
\ 'kind' : 'hook',
\ 'config' : {
\ 'enable' : 0,
\ 'bat' : ''}}
function! s:hook.on_module_loaded(session, context)
if type(a:session.config.exec) == type([])
let a:session.config.exec[0] = join([self.config.bat, $PROCESSOR_ARCHITECTURE, '\&']) . a:session.config.exec[0]
else
let a:session.config.exec = join([self.config.bat, $PROCESSOR_ARCHITECTURE, '\&']) . a:session.config.exec
endif
endfunction
call quickrun#module#register(s:hook, 1)
unlet s:hook
call extend(g:quickrun_config, {
\ 'c' : {
\ 'type' : 'c/vc'},
\ 'c/vc' : {
\ 'command' : 'cl',
\ 'exec' : [
\ '%c %o %s /nologo /Fo%s:p:r.obj /Fe%s:p:r.exe',
\ '%s:p:r.exe %a'],
\ 'tempfile' : '%{tempname()}.c',
\ 'hook/output_encode/encoding' : 'cp932',
\ 'hook/sweep/files' : ['%s:p:r.exe', '%s:p:r.obj'],
\ 'hook/vcvarsall/enable' : 1,
\ 'hook/vcvarsall/bat' : s:vcvarsall_bat},
\
\ 'cpp' : {
\ 'type' : 'cpp/vc'},
\ 'cpp/vc' : {
\ 'command' : 'cl',
\ 'exec' : [
\ '%c %o %s /nologo /Fo%s:p:r.obj /Fe%s:p:r.exe',
\ '%s:p:r.exe %a'],
\ 'tempfile' : '%{tempname()}.cpp',
\ 'hook/output_encode/encoding' : 'cp932',
\ 'hook/sweep/files' : ['%s:p:r.exe', '%s:p:r.obj'],
\ 'hook/vcvarsall/enable' : 1,
\ 'hook/vcvarsall/bat' : s:vcvarsall_bat},
\
\ 'cs' : {
\ 'type' : 'cs/csc'},
\ 'cs/csc' : {
\ 'command' : 'csc',
\ 'exec' : [
\ '%c /nologo /out:%s:p:r.exe %s',
\ '%s:p:r.exe %a'],
\ 'tempfile' : '%{tempname()}.cs',
\ 'hook/output_encode/encoding' : 'cp932',
\ 'hook/sweep/files' : ['%s:p:r.exe'],
\ 'hook/vcvarsall/enable' : 1,
\ 'hook/vcvarsall/bat' : s:vcvarsall_bat},
\
\ 'vbnet' : {
\ 'type' : 'vbnet/vbc'},
\ 'vbnet/vbc' : {
\ 'command' : 'vbc',
\ 'exec' : [
\ '%c /nologo /out:%s:p:r.exe %s',
\ '%s:p:r.exe %a'],
\ 'tempfile' : '%{tempname()}.vb',
\ 'hook/output_encode/encoding' : 'cp932',
\ 'hook/sweep/files' : ['%s:p:r.exe'],
\ 'hook/vcvarsall/enable' : 1,
\ 'hook/vcvarsall/bat' : s:vcvarsall_bat}})
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.