lambdalisue / vim-gina

👣 Asynchronously control git repositories in Neovim/Vim 8
http://www.vim.org/scripts/script.php?script_id=5531
MIT License
687 stars 27 forks source link

[commit] :wq prompts after vim 8.2.2900 #290

Closed itchyny closed 3 years ago

itchyny commented 3 years ago

Using :wq on gina-buffer-commit feature, gina is expected not to show confirmation prompt.

Do you want to commit changes? (Y[es]/n[o]):

However, starting from vim 8.2.2900, which fixes the issue https://github.com/vim/vim/issues/8279, the plugin starts to show confirmation prompt. It seems that the commit in Vim breaks the assumption of gina at https://github.com/lambdalisue/gina.vim/blob/97116f338f304802ce2661c2e7c0593e691736f8/autoload/gina/command/tag/edit.vim#L111.

lambdalisue commented 3 years ago

I see... Do you know any workaround for this?

itchyny commented 3 years ago

Removing the following line may fix the issue but not sure it breaks other behaviors. https://github.com/lambdalisue/gina.vim/blob/7069668147157d872821ebed1eee07742ece48fd/autoload/gina/command/commit.vim#L318

lambdalisue commented 3 years ago

Hum... That would break the behavior of :q which should show the prompt otherwise unwilling commit will be performed.

itchyny commented 3 years ago

How about checking the last command then?

  if histget('cmd', -1) !~# '^\(wq\|x\%[it]\|exi\%[t]\)'
    silent! unlet b:gina_BufWriteCmd
  endif

This is not perfect and does not work with ZZ though (should not prompt). But note that ZQ is unchecked (in L309) and invokes the commit unlike :q!.

lambdalisue commented 3 years ago

Nice. Would you mind if I ask you to create a PR for that?