New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stage visual selection (add -p) #269
Comments
Won't that only work if there have been no line additions or deletions in the file? |
I don't know if I'm misunderstanding something, but in the screencasts mentioned in README.md I learned, that in A function for directly staging visual-selected lines (without the need to |
Was just looking if this is possible and I think it would be a quite useful feature as well 👍 |
Yeah, I think so too! 👍 SourceTree can do this, it can even discard a selected range of lines: |
You can achieve this using
From, this vimcasts episode: http://vimcasts.org/episodes/fugitive-vim-working-with-the-git-index/ |
Awesome! Thanks 👍 |
I would also be very happy if such a feature was added. Using :Gdiff works but is a little clunky. |
Could you elaborate on “clunky”, please? |
@mcepl the workflow is:
This feels overcomplicated when I just want to "stage these lines". It is already possible to stage the current file with |
I kind of like the additional security in knowing that before I write |
The GitGutter plugin has this feature: https://github.com/airblade/vim-gitgutter#hunks very useful IMHO. |
Would like this too |
Hi. Do you have any updates on this feature? BTW thanks a lot for your awesome plugins! |
My update is I asked a question 6 years ago and nobody answered it. |
I see your point there. I have tried the script on deletion and it doesn't work. |
It would certainly be possible to filter the lines in |
As I understood, the |
If the file is already written to disk, the way to do this is to If the file has unwritten changes, that raises a bunch of questions, but I'd be fine to accept "write the entire file to the work tree first" as the path of least resistance. @sondnm The consequence I was alluding to is that someone might expect |
|
I will not accept an external dependency to avoid "looking at hunk headers and doing some counting". This isn't hard, it's just tedious. |
Makes sense. Maybe we could borrow the code from it then. |
I guess what is missing here is on the GStatus window when i open the file with enter i just enter a the fugitive diff mode and then stage the chunks from them? |
As a current workout around just press I on the status file right? |
You can do this in one step by pressing
That's less of a workaround and more of an alternative workflow, and as far as alternative workflows go, I'd sooner recommend pressing |
@tpope There's a real UX issue hidden behind this issue, and that is if you have the Gstatus open, you press enter, you go to the file to review the changes, you review and choose to stage specific hunks with diffput or whatever, then everything ok so far. BUT then you go to the status window to proceed with the hunks in the next file. The moment you press enter, the window with the staged version goes away, and you have to type again :Gdiff. This destroys the overall flow which you actually have with git add -pv. I'd rather take a step back and look at the flow in its entirety and make fugitive provide added value where it shines. For me, that is breaking out of the linear flow which I have in the terminal, for instance seeing the git status and the code at the same time. Also sometimes, I simply know what I want to stage, once I'm in a file and I see the whole context (thanks fugitive), doing :Gdiff is just additional fluff. Staging the selected range would improve the workflow immensly without giving up on the advantages of using fugitive. Think about it for a moment, how many keystrokes does a git add -pv user invest? The goal of fugitive should be to reduce that count (which it does naturally, because it breaks out of the linearity), but then you throw a compulsory :Gdiff in there and by doing so you throw away all the hanging fruit. Yet, I still appreciate the nonlinearity of fugitive, it would just speed me up if it would play along with the rest of the flow. |
You can do this in one step by pressing You can do this in one step by pressing You can do this in one step by pressing You can do this in one step by pressing You can do this in one step by pressing There, now hopefully everyone will actually see it.
I've already given advice on what's needed to implement it, so it's hard to read this as anything other than nagging me to do it myself. That will get you nowhere. |
Side-note: in the Gstatus window, you can press |
Ya lo lograron |
Estoy esperando ha que acaben de desinflar mi contenido para irme a mi otro cel y kmplementar más candados en este perfil jajaja si lo que puse aki es algo básico kieren algo más difícil? |
It would be great if fugitive could provide a mapping to stage the current visual selection of a file.
Obviously there is no straight forward way to achieve this. The only approach I could find is something that I found on stackoverflow and it involves fiddling around with the index behind git add's back
(http://stackoverflow.com/a/2785039/457853):
Maybe there are other ways to achieve the same? In either case it would be a feature that
I would love to see.
The text was updated successfully, but these errors were encountered: