Add a command to move the cursor to the next word
aimuzov opened this issue · comments
Hello! Thank you for the plugin. I have a suggestion. Would it be possible for you to implement focus shifting similar to how it is done in vscode? For example, upon pressing , it would highlight the next matching occurrence with the current selection (word).
Example from vscode docs:
I'm not sure, is this just creating cursors by searching for words? If so, that's already something I'm planning to do.
Hi @aimuzov, someone has submitted a PR for a command like VS Code's Ctrl+D, so I realised that it adds a cursor one at a time. You could check this branch to see if it works the way you want it to.
Hi @aimuzov, someone has submitted a PR for a command like VS Code's Ctrl+D, so I realised that it adds a cursor one at a time. You could check this branch to see if it works the way you want it to.
Hi @brenton-leighton. This is exactly what I wanted. Thank you very much. When will this be in the main branch?
@bokenator mentioned adding a command to skip a match.
I'm just wondering, what is the functionality that you want? If it's just incrementally adding cursors (rather than a copy of VS Code's Ctrl+D)?
I ask because maybe these two commands would work better:
- Add virtual cursor to current cursor position, then jump to next match
- Jump to next match (without adding a virtual cursor)
The first command would be the opposite of what Ctrl+D does (it doesn't move the real cursor, just adds a virtual cursor to the next match) but it would mean that the second command will give some feedback when a match is skipped.
@bokenator is that OK for you?
I agree. The proposal is even better. It's definitely helpful to have some feedback when a shortcut key is pressed. The only shortcoming I can think of is it'll be harder to return to the original cursor's location, but it doesn't affect my workflow and it's easy to write a custom function that creates a mark at the original cursor.
I've added the functionality to the feat_add_jump_next_match branch. There's two commands:
MultipleCursorsAddJumpNextMatch
: Add cursor and jump to next matchMultipleCursorsJumpNextMatch
: Jump to next match
The branch also renames the other search commands:
MultipleCursorsAddBySearch
has been renamed toMultipleCursorsAddMatches
MultipleCursorsAddBySearchV
has been renamed toMultipleCursorsAddMatchesV
@bokenator @aimuzov If there's no problems I will merge it.
@bokenator Restoring the cursor position when exiting multiple cursors sounds like a good idea, I'll probably add an option for that in the future.
Sounds great!
Thanks you very much!
This is merged now. I'll tag a new release soon.