mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-10-06 05:57:38 -04:00
n and N step through the files of a multi-file diff one at a time, which is a long way to the far end of a commit touching a hundred files. Bind ctrl+g to a menu of the diff's files, in the order the diff shows them and by the paths the repo knows them by; picking one goes to where its diff begins, exactly where stepping to it with n would have left you. The menu filters as you type, so the file you have in mind is a few characters away however many the commit touches. The key works in the panel the diff belongs to as well as in the diff itself. A commit is read from the commits panel, so being able to jump from there saves focusing the diff and leaving it again for the next commit; the diff scrolls to the file and the focus stays in the panel. It is ctrl+g rather than f because a key that works in every panel has to be free in all of them, and f is fetch in the files panel and fixup in the commits panel. The command applies only while the main view is showing a diff, and is left out of the keybindings menu where it isn't: over a branch's commit log, or while a conflicted file has given the main section over to the merge conflicts view. The diff is read to the end before the menu is built, as searching it does: a file below the part that has been read is in neither the list nor the view. Each item names its file rather than the row that file begins at, so that a diff re-rendered while the menu is up is jumped into at the row the file begins at now. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>