vim-gitgutter icon indicating copy to clipboard operation
vim-gitgutter copied to clipboard

Staging from hunk preview can stage change into wrong file

Open airblade opened this issue 3 years ago • 0 comments

  1. Open two different files.
  2. Change the first file and preview the change.
  3. Go to second window and then to hunk preview.
  4. Stage the hunk.
  5. Expected: change is staged into first file. Actual: change is staged into second file.

This is because the code uses wincmd p to return to the parent window when staging from a preview.

Solution: store the parent window in a buffer variable in the hunk preview and use that when returning to the original window.

airblade avatar Jun 02 '21 10:06 airblade