lambdalisue / vim-gina

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

add support for staging and unstaging hunks #274

Closed prabirshrestha closed 3 years ago

prabirshrestha commented 3 years ago

I would like to only stage few lines or changes in a file instead of an entire file.

Here are some list that would be good to have https://stackoverflow.com/a/1085191

y stage this hunk for the next commit
n do not stage this hunk for the next commit
q quit; do not stage this hunk or any of the remaining hunks
a stage this hunk and all later hunks in the file
d do not stage this hunk or any of the later hunks in the file
g select a hunk to go to
/ search for a hunk matching the given regex
j leave this hunk undecided, see next undecided hunk
J leave this hunk undecided, see next hunk
k leave this hunk undecided, see previous undecided hunk
K leave this hunk undecided, see previous hunk
s split the current hunk into smaller hunks
e manually edit the current hunk
? print hunk help

Was looking for something similar to https://github.com/airblade/vim-gitgutter

lambdalisue commented 3 years ago

I use 'patch' action or :Gina patch for that purpose and feel that's much easier compared to what vim-gitgutter has. Do you still need that feature?

prabirshrestha commented 3 years ago

do u have sample instructions on how to use it?

lambdalisue commented 3 years ago

Kapture 2020-09-30 at 15 04 35

prabirshrestha commented 3 years ago

Seems to work.

I did find one minor bug where if you start with :Gina status then use pp to patch and change in such a way that all becomes staged and close the patch tab :Gina status still reflects the old one.

Few options;

  1. Should there be an action called refresh for :Gina status?
  2. Even better if status gets updated once the tab closes.

If this is expected feel free to close since :Gina patch does solve my issue. It would be good mention in the splits what each split is such as original, staged and unstaged.

lambdalisue commented 3 years ago

You can use :e to refresh. Additionally, I'm not sure but I think I've implemented the feature to automatically refresh the buffer when autoread is enabled.