bloznelis / before.nvim

Jump to the last edit in Neovim
MIT License
118 stars 4 forks source link

Feature Request: Allow customizing cursor jump behavior #3

Closed ColinKennedy closed 8 months ago

ColinKennedy commented 8 months ago

If you have a file like

def foo():
    do_something()

And you edit

-def foo():
+def foot():
    do_something()

Then

def foot():
-    do_something()
+    do_blah()

Then

def foot():
-    do_blah()
+    foo_blah()

before.nvim records 3 changes, because the last 2 changes are on the same line. It'd be nice to be able to customize that behavior so same-line jumps are ignored and it just goes to the next position that is on a different file or line. And in this mode, the cursor always jumps to the first non-whitespace character instead of the exact column.

It'd probably be a good thing if these are 2 separately configurable options

bloznelis commented 8 months ago

To be honest it's trying to ignore same-line edits currently. Maybe I've missed some edge case, going to check. Thank you for a clear description!

ColinKennedy commented 8 months ago

You know I can't seem to reproduce it anymore. If it happens again I will let you know though!

bloznelis commented 8 months ago

Actually, now it might happen when you wrap around the history list, i.e. if the last and the first edits are in the same line. I will think how this could be solved, maybe deduplication logic can be improved further.