Replace current buffer if unchanged
This commit is contained in:
parent
a1edf556d0
commit
6d88ca4fa1
1 changed files with 12 additions and 2 deletions
14
c4ctrl.vim
14
c4ctrl.vim
|
@ -47,7 +47,11 @@ function C4ctrl(cmd, ...)
|
|||
|
||||
if stridx("get", a:cmd) == 0
|
||||
" Read current status into new buffer
|
||||
new
|
||||
if getbufinfo("%")[0].changed
|
||||
vnew
|
||||
else
|
||||
enew
|
||||
endif
|
||||
set filetype=conf
|
||||
silent execute "0 read !" s:c4ctrl "-o -"
|
||||
|
||||
|
@ -67,7 +71,13 @@ function C4ctrl(cmd, ...)
|
|||
echoerr "Error: could not open file" s:fn
|
||||
return
|
||||
endif
|
||||
execute "new" fnameescape(s:fn)
|
||||
|
||||
if getbufinfo("%")[0].changed
|
||||
vnew
|
||||
else
|
||||
enew
|
||||
endif
|
||||
execute "edit" fnameescape(s:fn)
|
||||
|
||||
elseif stridx("set", a:cmd) == 0
|
||||
" Set preset from current buffer
|
||||
|
|
Loading…
Reference in a new issue