Ability to multi-cursor select 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:

39 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.

3 Likes

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

+1 a super useful feature in Sublime

1 Like

+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!

4 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
4 Likes

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

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!

2 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?

Big YES

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

2 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