I've added this snippet to my .vimrc file to permit :q to quit both goyo and vim, but I noticed it doesn't work when I am using vimwiki and have multiple entries in my buffer, even if I remove the single buffer condition.
The pared-down snippet in my .vimrc is:
function! s:goyo_enter()
let b:quitting = 0
autocmd QuitPre <buffer> let b:quitting = 1
endfunction
function! s:goyo_leave()
if b:quitting
qa
endif
endfunction
autocmd! User GoyoEnter call <SID>goyo_enter()
autocmd! User GoyoLeave call <SID>goyo_leave()
Naturally, removing if b:quitting allows the me to leave vim w/:q, suggesting b:quitting not being set correctly by autocmd QuitPre, but I'm not sure where to go from here. Any thoughts on how to fix this?
Please check this from there Wiki, there are more commands to be added in your function.
I have copied this exact and it is working for me even with VimWiki.
I've added this snippet to my .vimrc file to permit
:q
to quit both goyo and vim, but I noticed it doesn't work when I am usingvimwiki
and have multiple entries in my buffer, even if I remove the single buffer condition.The pared-down snippet in my
.vimrc
is:Naturally, removing
if b:quitting
allows the me to leave vim w/:q
, suggestingb:quitting
not being set correctly byautocmd QuitPre
, but I'm not sure where to go from here. Any thoughts on how to fix this?I'm using vim 8.1.