-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] Create a cursor on jumplist entry #2808
[FEAT] Create a cursor on jumplist entry #2808
Conversation
This is a pretty neat idea! What happens if the jumplist switches to another buffer? I would argue the forward equivalent isn't a bad idea to include, if you overshoot the jumplist and need to go forward. |
It panics 😅. Sorry, I hadn't checked, I will look into into it and maybe add a test if I figure out how to cover that. Regarding the forward variant, I have tried and it is fine. I would not use it a lot but if this is merged, a user will ask for it at some point; I think I'll add it. |
Keymap-wise, I'm not a big fan of For docs, I've been meaning to add a section to Forward variant: we could implement it and not bind it if we don't think it will be useful. That way someone can bind it themselves if they find a use for it without needing to change the code. |
I have fixed the problems with jumping to another buffer, removed the keymap ( Anyways, this PR may not be worth it if marks are a desired feature. |
let count = cx.count(); | ||
let view = view_mut!(cx.editor); | ||
let (view, doc) = current!(cx.editor); | ||
let mut this_selection = doc.selection(view.id).clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This clone is not required if copy_cursor
is true, could it be avoided in some elegant way?
yeah I was thinking similar: marks seem to be a cleaner approach to this, especially if we had the rich operations from kakoune's It looks like @archseer is interested in tackling marks because of some prior experience with it in nvim but it might not be a priority for him at the moment #703 |
Closing in favor of a future implementation of marks. |
Related to #2784 (comment)
This PR adds a command
copy_cursor_backward
that creates a new cursor by jumping backward in the jumplist, preserving the previous selection. This adds a flexible way of editing text with multiple cursors, especially when combined with textobjects motions.Demo
Save selection to jumplist
C-s
, jump to function]f
, copy cursor backwardC-q
:TODO
C-q
for no particular reason.