Refactor vim compile functions

This commit is contained in:
Marty Oehme 2020-02-03 22:10:11 +01:00
parent 92376839a4
commit 6b79eeef5d
4 changed files with 49 additions and 29 deletions

View file

@ -1,22 +0,0 @@
function CompileDoc()
:execute(":w!")
:execute(":!compile \"%\"")
endfunction
function CompileDocNoOutput()
:execute(":w!")
:execute(":silent !compile \"%\"")
endfunction
function CompiledOpen()
:execute(":silent !open-compiled \"%\"")
endfunction
function CompileDocAndOpen()
call CompileDocNoOutput()
call CompiledOpen()
endfunction
command CompileDoc call CompileDoc()
command CompileOpen call CompiledOpen()
command CompileDocAndOpen call CompileDocAndOpen()

View file

@ -0,0 +1,25 @@
function s:_compile(verbose, ...)
:execute(":w!")
if a:verbose
execute "!" . "compile" . " " . "%" . " " . join(a:000)
else
silent "!" . "compile" . " " . "%" . " " . join(a:000)
endif
endfunction
function s:_open(verbose, ...)
if a:verbose
execute "!" . "open-compiled" . " " . "%" . " " . join(a:000)
else
silent "!" . "open-compiled" . " " . "%" . " " . join(a:000)
endif
endfunction
function s:_compileopen(verbose, ...)
call s:_compile(<bang>0, <f-args>)
call s:_open(<bang>0, <f-args>)
endfunction
command -bang -nargs=* DocCompile call s:_compile(<bang>0, <f-args>)
command -bang -nargs=* DocCompileOpen call s:_compileopen(<bang>0, <f-args>)
command -bang -nargs=* DocOpen call s:_open(<bang>0, <f-args>)