Git Jump to Vim QuickfixEvan Travers
git ships with a script called git-jump to populate vim's quickfix list with hunks or merge conflicts… without using any vim plugins at all.
My friend Seth and I were talking about the quickfix list. My first introduction to the quickfix was back in school, working with compilers. It was my best friend then… make some changes, check the quick fix, clean it out, continue… it's the best!
Because I haven't been working with compiled languages in a long while I've been using quickfix for other things. For years, it's been my solution to the "search and replace in project" problem:
:grepto populate the quickfix list with the locations of everything I want to change.
- Record a macro that replaces this instance with the new one, and navigates to the next location (
:cn) and calls itself.
Thanks to how awesome
:netrw is, that even works over FTP or SSH.
While thinking of good reasons to use quickfix over the buffer list, I realized a couple of other neat tricks using some modern neovim tooling:
I use telescope.nvim pretty much everywhere now. By default, if you press
<c-q> in a telescope view, it dumps the selection or marks into your quickfix. I'm using this with live grep often to do some spelunking on a particular variable.
While research the git workflow (because we all spend time in merge conflicts!) I came across a script that ships with git-contrib: git-jump
git-jump will work on any computer or server with vim and git (so, nearly all!?) There have been a few times working on a server or container that I really could have used this, so I'm excited to have this for the next time I'm working on a remote server or someone else's workstation.
Chris Dillon kindly pointed out a robust alias for git-jump so that you can use it as
git jump in your .gitconfig:
[alias] "jump = "!$(brew --prefix git)/share/git-core/contrib/git-jump/git-jump""
2022-06-08 11:31:29 -0500Rename articles
2022-06-07 15:27:31 -0500Adding Admonitions
2022-04-15 13:04:51 -0500Adjust the git alias thanks to Chris Dillon
> About the git jump post, there's a version and also install agnostic way to get the installed path. Homebrew is changing from /usr/local and the version of git might change so that alias will break. Homebrew will link the whole directory so you can just go to the homebrew root and navigate to git.
> So this alias will work:
> `jump = "!$(brew --prefix git)/share/git-core/contrib/git-jump/git-jump"` which survives version changes but also the upcoming move to `/opt/homebrew` for Apple Silicon.
Thank you sir!
2022-04-14 16:25:11 -0500Fix link on gitsigns
2022-04-14 16:22:50 -0500Vim Quickfix