vim - Handle exclamation mark after command definition as :wq -



vim - Handle exclamation mark after command definition as :wq -

i'm looking way create handle ! after command :wq!. in order create own function quitting and/or writing files. tried of course, didn't works :

command! -nargs=0 sq :call <sid>saveandquit(0, 0) command! -nargs=0 swq :call <sid>saveandquit(1, 0) command! -nargs=0 sq! :call <sid>saveandquit(0, 1) command! -nargs=0 swq! :call <sid>saveandquit(1, 1)

with function function! <sid>saveandquit( write, forcefulness ). there way handle !?

yes, should utilize -bang attribute, pass function, , handle ! in function.

:h bang

e.g.

command ... -bang xyz phone call function('foo', <bang>0)

your function:

func function (argstr, bang).. "here check a:bang decide should done.

vim

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -