Vim icon indicating copy to clipboard operation
Vim copied to clipboard

Feedback about Multi-Cursor Mode

Open johnfn opened this issue 10 years ago • 121 comments

This is a thread for feedback about Multi-Cursor Mode. I don't use it all that often, so I'm open to any and all suggestions about what it should do or be like.

johnfn avatar Oct 03 '16 20:10 johnfn

As of 0.3.0 (Windows, Code 1.5.3), it's very difficult to actually get into Multi-Cursor Mode from Normal Mode. Using the Add Cursor Above/Below shortcuts in Normal mode, it will expand the cursor appropriately but then the first command that gets invoked will only apply to the first line. See the following screencast:

multicursor

The commands I tried were in this order:

  • dw
  • x
  • i

Note that I was only able to get to mult-cursor/normal mode by first entering Insert mode, adding cursors, making a change, and then exiting into Normal mode again.

jgoz avatar Oct 03 '16 22:10 jgoz

Thanks for the feedback @jgoz! I don't actually have a Windows machine, so that probably explains some of your problems. :P

I'm curious how the new command gc that we added works for you?

In the meantime I'll see if I can find someone with a Windows machine to do some testing.

johnfn avatar Oct 03 '16 22:10 johnfn

I'm curious how the new command gc that we added works for you?

I'm not sure exactly how gc is supposed to work, but here's what happens on my machine:

  • gc -> highlight all occurrences of a string
  • any other command (d, etc): only execute command on the first string that was selected

If I keep doing gc, it will add the selections one-by-one and then commands I execute will operate on those selections. I can do another screencast if my description was unclear :)

jgoz avatar Oct 03 '16 23:10 jgoz

gc should add another cursor at the next instance of the word. It should be exactly the same as cmd-d.

Then once you've added a bunch of cursors, you should be able to run vim commands on all of them.

If I keep doing gc, it will add the selections one-by-one and then commands I execute will operate on those selections.

This sounds like desired behavior, at least for "gc does the same as ctrl-d". Am I wrong?

johnfn avatar Oct 03 '16 23:10 johnfn

@jgoz I think I see the bug for Windows. Give me a sec.

johnfn avatar Oct 03 '16 23:10 johnfn

This sounds like desired behavior, at least for "gc does the same as ctrl-d". Am I wrong?

Sounds like it. I tested this out on my Mac at home and it behaves the same as Cmd+D.

One issue I did notice with both Cmd+D and gc is that (in Normal mode) if you run it on a word with a trailing comma, the comma will be part of the selection in the first instance. I can file this as a separate issue if you like.

@jgoz I think I see the bug for Windows. Give me a sec.

👍

jgoz avatar Oct 04 '16 04:10 jgoz

Hi i use (Vscode 1.6.0 Insider, Windows 7, Vim 0.3.0), it seams that VsCodeVim eats the Add Cursor Above/Below shortcuts: vscodevim eats shortcut If i uninstall the extension the shortcuts working just fine.

And you can see another issue in the gif. If i add a new cursor below in normal mode an switch to insert mode only the main cursor is acitve.

Platzer avatar Oct 04 '16 10:10 Platzer

Yep, windows 10 and gc only highlights multiple selections but any operation I do are applied only for the first one.

habamax avatar Oct 05 '16 07:10 habamax

Yeah, sorry about that! It seems like it's no good on Windows. Once #835 is done I will address those problems and push out a new version!

johnfn avatar Oct 05 '16 07:10 johnfn

Thanks a lot for the work! I didn't know the multi-cursor is the one with cmd+alt+down (just looked at it and it looks awesome), so I used Ctrl+V to activate it:

The blinking cursor is a bit annoying.

mc

And here I'm pressing w and b.

w

cmd+alt+down version doesn't have these issues. I'd suggest letting Ctrl-V use the multi-cursor implementation, as all its use cases are covered by multi-cursor. IIRC that is what Atom and Sublime's Vim implementation was using.

Again, thanks for the multi-cursor support. It's amazing.

octref avatar Oct 05 '16 17:10 octref

Hey there @johnfn, thanks for creating this. Works great when using vim commands, but there is no interoperability with VSCode's native selections, is this right? i.e. if I select text using Shift + arrow keys in insert mode, and press command + d, I get the following:

The first part is when I use VSCode's selections (shift+option+arrow key) + cmd-d, the last part is using Vim selections (vaw) + cmd-d.

oct-06-2016 10-11-12

Would this fixed by #832?

frederickfogerty avatar Oct 05 '16 21:10 frederickfogerty

Some strange behavior I noticed:

  1. alt+cmd+up/down (editor.action.insertCursor{Above/Below}) only works in normal mode - why not in insert mode?
  2. alt-clicking for multiple cursors in normal mode, after i, only the first cursor remains

vogler avatar Oct 06 '16 12:10 vogler

@johnfn On macOS Sierra, when I try to highlight a word and then use "Replace all occurrences" feature it doesn't work property, only the originally highlighted word gets replaced, while for all the others the text gets appended.

maciej-trebacz avatar Oct 11 '16 09:10 maciej-trebacz

Use cw command on last word of lines will cause lines incorrectly join together. macOS 10.11

zmx avatar Oct 11 '16 10:10 zmx

Has anybody tried using multiple cursors on Linux? I'm having no luck at all, neither with editor.action.addSelectionToNextFindMatch nor editor.action.insertCursorAbove. In both cases any action carried out only hits the first cursor instance.

d-sparks avatar Oct 26 '16 13:10 d-sparks

On Windows, latest VSCode and VsCodeVim:

If I'm in normal mode, hit Ctrl+D to select multiple words, then hit i to insert, it rolls back to one cursor. Same with all other insertion commands. c doesn't even work.

If I'm in insert mode, hit Ctrl+D to select multiple words, then try to move the cursors using the arrow keys, it rolls back to one cursor.

gc command doesn't let me i or a, only I or A. Is this the behavior of the visual mode multi cursor? What's the benefit?

Thanks for your support!

colltoaction avatar Oct 27 '16 14:10 colltoaction

Lots of good feedback here. Thanks, guys.

@tinchou The reason that i and a don't work is because you start off in visual mode in multi cursor mode, and i and a don't do anything in visual mode. Hit <esc> to go back to normal multi cursor mode, and then use i or a.

I have no idea why ctrl-d isn't working for you, though. That's definitely a bug.

@d-sparks I definitely haven't tried Linux, so that could very well be possible, unfortunately.

johnfn avatar Oct 29 '16 00:10 johnfn

using linux and I'm having the same behaviour as @d-sparks

zontafil avatar Nov 02 '16 09:11 zontafil

VS Code 1.7.1 and Vim 0.4.1 on OS X 11.6

cmd+d or gc correctly select multiple occurrence but I can't enter insert mode, tried s c i a none of them work

kuntau avatar Nov 04 '16 06:11 kuntau

You go into visual mode by default, because you're selecting text. Press esc to go into normal mode like normal and then i also like normal.

johnfn avatar Nov 04 '16 11:11 johnfn