Split vertical when a new window is required

This commit is contained in:
Shy 2017-04-03 18:26:46 +02:00
parent 7dfd213402
commit 66fa06c11a

View file

@ -1,7 +1,7 @@
" This Vim plugin makes some functionality of the c4ctrl utility available " This Vim plugin makes some functionality of the c4ctrl utility available
" from within Vim. " from within Vim.
" "
" Last Change: 2017 Mar 29 " Last Change: 2017 Apr 03
" Maintainer: Shy " Maintainer: Shy
" License: This file is placed in the public domain. " License: This file is placed in the public domain.
" "
@ -78,7 +78,8 @@ function C4ctrl(command, ...)
" Read current status into new buffer " " Read current status into new buffer "
" *********************************** " " *********************************** "
if getbufinfo("%")[0].changed if getbufinfo("%")[0].changed
new " Spawn a new window if the current buffer has changes
vnew
endif endif
silent execute "0 read !" s:c4ctrl "-o -" silent execute "0 read !" s:c4ctrl "-o -"
call s:SynHighlight() call s:SynHighlight()
@ -103,12 +104,13 @@ function C4ctrl(command, ...)
endif endif
if getbufinfo("%")[0].changed if getbufinfo("%")[0].changed
new " Spawn a new window if the current buffer has changes
vnew
endif endif
execute "edit" fnameescape(s:filename) execute "edit" fnameescape(s:filename)
call s:SynHighlight() call s:SynHighlight()
unlet! s:filename unlet s:filename
elseif stridx("set", a:command) == 0 elseif stridx("set", a:command) == 0
" ****************************** " " ****************************** "
@ -177,7 +179,7 @@ function C4ctrl(command, ...)
execute "saveas" fnameescape(s:filename) execute "saveas" fnameescape(s:filename)
endif endif
unlet! s:filename unlet s:filename
else else
" ****************** " " ****************** "