Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

I have this keymapped in my .vimrc:

 :vertical Git log -p -- %<CR>

This lets me open a vertical split and show the patches for each commit that touched the current file:

-----------------------------------------------------------------------------------
| // some/file                                | commit def                        |
|                                             | Author: me                        |
| def hereIsCode() {                          | Date: 2024/04/21                  |
|   if (i < 3code) {                          |                                   |
|     writeMoreCode()                         | diff --git blahblah               | 
|   }                                         | +writeMoreCode()                  |
| }                                           | -writeLessCode()                  |
-----------------------------------------------------------------------------------

That's handy, but what I really want is to open a vertical split of commits and show the changes to the file in each commit in one split as I step through them in the other split (or maybe in a quickfix or location list). This is a little hard to visualize, but something like this:

-----------------------------------------------------------------------------------
|    // some/file                             | commit def do the third thing     |  <- cursor here
|                                             | commit bcd do the second thing    |
|    def hereIsCode() {                       | commit abc do the first thing     |
|      if (i < 3code) {                       |                                   |
| +      writeMoreCode()                      |                                   |
| -      writeLessCode()                      |                                   |
|      }                                      |                                   |
|    }                                        |                                   |
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
|     // some/file                            | commit def do the third thing     |  
|                                             | commit bcd do the second thing    |  <- cursor here
|    def hereIsCode() {                       | commit abc do the first thing     |
| +    if (i < 3code) {                       |                                   |
| -    if (code == meh) {                     |                                   |
|        writeLessCode()                      |                                   |
|      }                                      |                                   |
|    }                                        |                                   |
-----------------------------------------------------------------------------------

etc.

Is there a way to achieve this, or something like it, with Fugitive?

You must be logged in to vote

Replies: 1 comment

Comment options

Use :0GcLog then :Gvdiffsplit >!^.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.