sindrets / diffview.nvim

Single tabpage interface for easily cycling through diffs for all modified files for any git rev.
Other
3.85k stars 105 forks source link

Cursor is always placed at end of file diff when `<tab>`ing between files #311

Closed briandipalma closed 1 year ago

briandipalma commented 1 year ago

Is this intentional? I open up a diff and move the cursor to the right hand side file of the diff view (the "after" change view I guess), I <tab> to the next file and the cursor is moved to the bottom of the next file diff. I'd say the first change from the top is a better place for the cursor to be. Or am I missing something?

sindrets commented 1 year ago

The plugin does move the cursor to the top of the file the first time an entry is opened in a view. Perhaps you have an interfering auto command or something? Try to reproduce the issue with a minimal config. Here's a template.

briandipalma commented 1 year ago

I'll close it and try and understand what's happening 👍

briandipalma commented 1 year ago

I didn't realize there was a C-b/C-f mapping to scroll up and down diffs so I kept changing window into the diff to scroll up and down there and when you do that yes the cursor gets placed at the bottom of the diff :roll_eyes:

sindrets commented 1 year ago

when you do that yes the cursor gets placed at the bottom of the diff

No, this is not default behavior in the plugin nor in nvim, as can be demonstrated by using the minimal config. You probably have an auto command that tries to restore cursor position on BufEnter or something.