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

Commit

Permalink
Merge pull request #291 from itchyny/fix-wq-quitpre
Browse files Browse the repository at this point in the history
Keep the flag of BufWriteCmd on :wq command
  • Loading branch information
lambdalisue authored Jun 12, 2021
2 parents 7069668 + 6eba566 commit abdbe0f
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 abdbe0f

Please sign in to comment.