unblevable / quick-scope

Lightning fast left-right movement in Vim
MIT License
1.42k stars 54 forks source link

Add motion to jumplist #78

Open darzok0914 opened 2 years ago

darzok0914 commented 2 years ago

hi, I have been using your plugin for quite a long time, however something that I find missing is the fact that jumps are not saved in the jump list, which would be nice to have at least as an option so that we could go back to the location before doing the motion by press

I tried to do a remap and manually set a mark before doing a motion but the only effect was to deactivate the plugin itself.

is there a quick solution to this ?

bradford-smith94 commented 2 years ago

So quick-scope itself isn't controlling the movement of the cursor, that is still handled by the appropriate f/t command, so we can do things before the movement but not after.

I did a little testing (without editing the plugin or any mappings yet) by setting the previous position mark as recommended by this StackOverflow answer (m`) before my f/t movement, and this allowed me to use <C-o> to jump back to before the f/t movement, but I could not subsequently use <C-i> to repeat the f/t movement (I think because this is within a line movement so <C-o> doesn't update the jumplist?). This seemed like a sub-optimal solution to me.

What I described (simply setting m`) could feasibly be done in the plugin, if you think it's the behavior you want. I think it should only need adding normal! m` somewhere in quick_scope#Ready().

darzok0914 commented 2 years ago

yes that is the behaviour I was trying to describe, do you think it would be wise to deactivate that option by default and expose a setting so that users can enable only if they want to ?

bradford-smith94 commented 2 years ago

Yes, I think this should default to off so that we don't unexpectedly mess with anyone's jumplist.

darzok0914 commented 2 years ago

I'm happy to try implementing this. if I'm being honest I never contributed to an open source project before so it could be a good learning experience for me as well. let me know

bradford-smith94 commented 2 years ago

Sure, I'd be happy to look at a pull request.

darzok0914 commented 2 years ago

sounds like a plan, I'll have a look at this over the weekend as I'm pretty busy with work during the week