Ability to add multi-cursor with keyboard

I know we can hold cmd and click to select multiple cursors. But it would be great to be able to do the same with the keyboard. Like atom and sublime text does. :slight_smile:

49 Likes

Agreed, it is a big pain to be typing and then have to not only alt+click, but also AIM for what you want. The keyboard is much easier to use / harder to screw up.

In sublime/vscode/atom, you can also highlight word with ctrl+d and repeatedly press it to highlight the next instance of that word and drop another cursor there. Itā€™s very handy!

They also have functions like ctrl+shift+down/up-arrow to drop a new cursor on the next/previous line in the same column. Doing that then doing ctrl[+shift]+left/right to move/select by word is the best!

Lack of this feature is really holding obsidian back as a ā€œgo-toā€ powerful text editor.

5 Likes

+1 For this feature. It one of the main reasons I open up text in VSCode to edit it

1 Like

+1 a super useful feature in Sublime

2 Likes

+1 - this would be really helpful

+1 - yes, please!

+1 here too
And Iā€™d love to be able to change the default shortcut for multi cusor too.

I was so happy to see Multiple Cursors as an option! This is awesome!

With that said, before I found that I was using Sublime Text back and forth to do big changes because I didnt know I could do the multiple cursors since it uses a non-conventional approach.

I would love to have some Sublime Text stuff like

  • Alt+F3 to select all entries of a string.
  • Ctrl+Shift+L to add a cursor at the end of every selected line.
  • Ctrl+D to select the next entry of a string in the file.

I would love to have all 3 of these but I think Alt+F3 and Ctrl+Shift+L would be the most important functions for me.

Obsidian is already great but this would make if freaking DOPE!

8 Likes

I agree! I keep flipping to Sublime Text to use the keyboard shortcuts for multiple selection.

For reference, hereā€™s what Sublime Text offers:
https://www.sublimetext.com/docs/multiple_selection_with_the_keyboard.html

Of these, the most important for me are:

  • Add a line above or below the current cursor/selection
  • Add the next occurrence of the current word to the selection
  • Add all occurrences of the current word to the selection
8 Likes

Agreed, this is on of the only annoying things about writing in Obsidian.

1 Like

Good news!

I came across this thread while I was researching for my multi-cursor plugin (personally my pain point was that once you create a multi-selection, you canā€™t click on it again to deselect).

Since I was feeling groovy, I added the basic sublime text keyboard shortcuts too:

  • Ctrl-D: Select next occurrence of selected word
  • Ctrl-Alt-Up: Add a cursor to the line above
  • Ctrl-Alt-Down: Add a cursor to the line below

Iā€™m just investigating how to publish it, but if youā€™re interestedā€¦

At some point Iā€™ll look at adding the ā€œselect all occurrences of selectionā€ and ā€œmove every cursor to the end of the lineā€ too :+1:

Iā€™ll post again when itā€™s published!

8 Likes

Also gonna plugin my plugin here: Advanced Cursors can do some of these things and more!

3 Likes

Haha, I saw your plugin just as I was publishing mine!

By the looks of it yours is capable of much more advanced functionality. If you were to steal the ā€œClick to de-selectā€ functionality from mine I would probably just use yours instead :grin:.

Also, in case you didnā€™t know (or maybe you donā€™t want to add them), you can supply default keybindings to your commands like this:

this.addCommand({
      id: "add-cursor-to-prev-line",
      name: "Add New Cursor to Previous Line",
      editorCallback: ...
      hotkeys: [
        {
          modifiers: ["Ctrl", "Alt"],
          key: "ArrowUp",
        },
      ],
    });

Haha I really want to add that functionality :joy: I read over your code a bit, and it seems we are approaching it in relatively different ways (as different as can be for two plugins using the editor).
I think I will add click-to-deselect to mine, just to have it all in one place.

Yeah, I prefer not to set default hotkeys, as they may conflict with existing ones

Sweet! Iā€™ll pull my one out. Makes sense that mine is a bit different as I just hacked away at it until it worked. I suppose when some better docs come out things will probably standardize a bit.

Itā€™s great to see so many options for working with multiple cursors. Still, it doesnā€™t look like any of these address OPā€™s ā€œmulti-cursor select with keyboardā€ yet. Is it possible some way?

1 Like

Big YES

@dylan_k I found this today. Exactly what you need. But, it isnā€™t published yet.

4 Likes

This is just the thing I need for ā€œput a cursor at the end of all selected lines.ā€

Is there something I can use for an equivalent to vscodeā€™s ā€œselect all occurrences of current selectionā€? When writing, I find this invaluable for quickly renaming something in a longer note.

+1 for this feature