Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
Keep the flag of BufWriteCmd on :wq command
Browse files Browse the repository at this point in the history
Vim 8.2.2900 changed the event order on :wq command.
  • Loading branch information
itchyny committed Jun 12, 2021
1 parent 7069668 commit 6eba566
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions autoload/gina/command/commit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,17 @@ function! s:QuitPre() abort
call win_gotoid(win_id)
endif
endif
silent! unlet b:gina_BufWriteCmd
" Clear the flag set by :w but keep it when user hit :wq
if histget('cmd', -1) !~# '^\(wq\|x\%[it]\|exi\%[t]\)'
silent! unlet b:gina_BufWriteCmd
endif
endfunction

" NOTE:
" :w -- BufWriteCmd
" <C-w>p -- WinLeave
" :wq -- QuitPre -> BufWriteCmd -> WinLeave
" :wq -- QuitPre -> BufWriteCmd -> WinLeave (-8.2.2899)
" BufWriteCmd -> QuitPre -> WinLeave (8.2.2900-)
" :q -- QuitPre -> WinLeave
function! s:WinLeave() abort
if exists('b:gina_QuitPre')
Expand Down
8 changes: 6 additions & 2 deletions autoload/gina/command/tag/edit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,17 @@ function! s:QuitPre() abort
call win_gotoid(win_id)
endif
endif
silent! unlet b:gina_BufWriteCmd
" Clear the flag set by :w but keep it when user hit :wq
if histget('cmd', -1) !~# '^\(wq\|x\%[it]\|exi\%[t]\)'
silent! unlet b:gina_BufWriteCmd
endif
endfunction

" NOTE:
" :w -- BufWriteCmd
" <C-w>p -- WinLeave
" :wq -- QuitPre -> BufWriteCmd -> WinLeave
" :wq -- QuitPre -> BufWriteCmd -> WinLeave (-8.2.2899)
" BufWriteCmd -> QuitPre -> WinLeave (8.2.2900-)
" :q -- QuitPre -> WinLeave
function! s:WinLeave() abort
if exists('b:gina_QuitPre')
Expand Down

0 comments on commit 6eba566

Please sign in to comment.