Carles Andres' avatarHomeBlog

Navigate through your uncommitted changes in Neovim

Today I found myself wanting to navigate through my uncommitted git changes faster.

I had a hunch that gitsigns.nvim, which I was only using for indicating which lines had changes, should be capable of it.

And... oh yeah! gitsigns has a family of commands just for that:

:Gitsigns setqflist           " Populate the quickfix list with current buffer's hunks
:Gitsigns setqflist attached  " Populate the quickfix list with the open buffer's hunks
:Gitsigns setqflist all       " Populate the quickfix list with all project hunks

You can replace setqflist with setloclist if you want the location list populated instead of the quickfix list.

After that, you can navigate your quickfix list as you normally would. This normally means :cn and :cp if you don't have vim-unimpaired, or ]q and [q if you do.