I want to check file before quitinq
vim with custom functions, everything seems fine with
QuitPre autocommand except using
ZZ to exit. In this case the output is missing.
Consider following function declaration and autocommand in file
au QuitPre * call CheckBeforeQuit() function CheckBeforeQuit() echo 'Hello' echo 'World' call input('Press enter') endfunction
And now when I open file
tmp with this command
vim tmp -u NONE -c 'source function.vim'
and then type
:x, the output
Hello\nWord along with prompt message is visible. If I use
ZZ instead, the message from
echo is missing. According to help
ZZ is the same as
Of course I could remap
:x and everything is fine now. But anyway I would like to know what is causing this difference and how I could deal with that in my function.