VSCodeVim/Vim

Feedback about Multi-Cursor Mode

johnfn opened this issue ยท 120 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.

jgoz commented

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.

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.

jgoz commented

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 :)

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?

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

jgoz commented

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.

๐Ÿ‘

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.

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

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!

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.

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?

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

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

zmx commented

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

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.

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!

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.

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

I also can not use multi cursor properly in ubuntu and none of the vscode shortcuts work either such as add cursor below

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

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 I think that is not the expected behavior. When I select a block of text, I expect c or s to replace the text, not to enter insert mode and C-w to delete word. Even if I Esc to normal mode, ciw or cw still doesn't work.

Should we follow terryma/vim-multiple-cursors behavior? Since it will provide consistent experience across editor

Oh I see. Yeah, it is broken. That's a bug. c and d should definitely work.

@johnfn take a look at #1029 should fix d and c.

@johnfn I'm noticing this behavior on Linux:
Using Visual Block and then using I to insert at the beggining of Visual Block it inserts one character before.
Better demonstrated with some gifs:
how it should work (gvim):
vim
how it works:
code_bad
it actually works with two columns selected:
code

I think it'd be super helpful to have surround.vim mode work with multiple cursors. Right now the surround is only applied to the first cursor:

kapture 2017-02-02 at 7 00 44

Is there a way to enter the multi-cursor mode directly from the insert mode on Linux/Windows (same as cmd-d in Mac)? E.g. steps:

  • Go to insert mode (i)
  • Select some code (keep shift down, press right multiple times)
  • [do something] -> should add second cursor to next occurrence of selected code

@blaind: It was really throwing me off as well, being unable to go into multiple-cursor mode from insert mode. Managed to fix it with custom keyboard shortcuts though.

Change cmd to ctrl if on windows (I think?).
Never mind, the custom shortcuts below seem to cause some issues. Noticable when using up/down arrows to select autocomplete options.

[{
  "key": "cmd+d",
  "command": "editor.action.addSelectionToNextFindMatch",
  "when": "editorTextFocus"
},
{ "key": "left",
  "command": "cursorLeft",
  "when": "editorTextFocus"
},
{ "key": "right",
  "command": "cursorRight",
  "when": "editorTextFocus"
},
{ "key": "down",
  "command": "cursorDown",
  "when": "editorTextFocus"
},
{ "key": "up",
  "command": "cursorUp",
  "when": "editorTextFocus"
}]

How can I select all const in this code?
image

My usual workflow is to select const, Cmd+D to select other occurrences, but it is not working

@montogeek Try gc on the first const.

It seems to me that many people (originally I myself included) mistakenly believe multi-cursors to be completely broken in this package.

In my case it has to do with Cmd-d only working in normal mode combined with the fact that as soon as you press it you inexplicably throws you into visual multi cursor mode (So, no. a and i are not broken as I first thought).

I believe that multi-cursors would be far more user friendly if Cmd-D did not change what mode you are on. If you are on normal mode when you press it you should remain in normal mode. Additionally, multi cursors are even useful in insert mode, so I see no reason why Cmd-D should be disabled for that mode. Another argument for not disabling multi-cursors in insert mode is that it is standard out-of-the-box VSCode functionality that this package is effectively removing, hence forcing potential users to disable or remove this package to recover lost functionality.

The latest release should have a lot of improved multicursor functionality. Alt+mouse click to add cursors, find all occurences, cmd up/down, add cursor above/below tast...

Likewise, if you want to try it you can add

"vim.handleKeys": {
        "<D-d>":false
}

To your settings and see if that changes anything for you, this is not tested though so I am not sure it will help at all

@RodrigoRoaRodriguez The reason cmd-d puts you in visual mode is because cmd-d in VSCode selects the entire word. Doing otherwise would be changing the behavior of the VSCode keybinding!

A few people have mentioned that this is surprising behavior, and I know that surprising behavior is usually bad. Perhaps we should override cmd-d to not select the whole word in VSCodeVim?

I do understand what you mean by cmd-d working in insert mode. That should be an easy fix.

Also yeah, @xconverge did some awesome work that allows a bunch of multi cursor stuff to just magically work in the latest version. It's really awesome.

@johnfn I understand that Add next occurrence (cmd-d) selects the whole word and that is perfectly reasonable explanation. This is indeed desirable behavior when the user is visual mode. However, if the user is in normal mode it should assumed that they want to perform normal mode operations rather than visual mode operations, and changing to visual mode as a side effect of Add next occurrence only lengthens the optimal path of multi-cursor normal mode operations and may even confuse the user if they are unaware that they have changed mode.

@xconverge Wow, I tried the new release it and I was pleasantly surprised. In terms of interaction it felt completely natural to me with the change in settings. I feel that it is a lot closer to what the default should be as it does not remove as much functionality.

Cidan commented

I do understand what you mean by cmd-d working in insert mode. That should be an easy fix.

This is huge and has stopped me from using this plugin for months. I keep checking back every few weeks to see if it's been fixed, but end up going back to amVim just because this particular behavior has not been fixed. cmd-d needs to work in insert mode and keep you in insert mode.

To your settings and see if that changes anything for you, this is not tested though so I am not sure it will help at all

Worked for me using the following workflow:

  1. Selected word in visual mode
  2. Pressed cmd-d desired number of times
  3. Changed word using c

It's important to note that it wouldn't work if I didn't select the word in visual mode first, even if my cursor was on top of the word. Hope this helps anyone having issues.

How exactly can I select one word, find all occurrences, then change them all at the same time?
I can't make that work :/

c or i only allow me to change the first word selected

@montogeek Right click -> change all occurrences seems to work for me. It puts a cursor at the end of each word. Then I type b, then c and then type whatever I want to change the word to.

@johnfn How do you select a word?
I am doing this:

  1. vw to select word
  2. With my mouse, right click on it -> change all occurrences (I see a cursor at the end of each ocurrence)
  3. Type b, place cursor at the start of the select word, all others cursors disappeared
  4. Type c, fist character of the word is removed, then switch to insert mode

@johnfn Sorry, after update to 0.6.15, It worked following your steps, Thank you so much!

Awesome :) Thank @xconverge though ๐Ÿ˜‰

mgutz commented

What is the equivalent of Ctrl+K, Ctrl+D which skips a word and moves to next match when setting multiple cursors?

a-eid commented

One one is done with multiple cursors , how to go back to one . preferable to the original cursor when all started .

ESC should do it @a-eid

@mgutz it doesnt actually currently exist :/ alt-click is an okay alternative until it does

Using Windows 7 here with VS Code 1.11.2 & 0.6.16 of VSCodeVim.

If I'm in insert mode, I can't select text & use ctrl+d to select the remaining which kind of sucks.

The g+c shortcut works decent though. I'll select text using visual mode which for not experienced Vim users is the v key. So something like v w will highlight the remaining part of a word. Then I can use g+c to highlight matching words. Then I'll type v again to exit visual mode & i to enter insert mode. Then I can type in all the instances. Unfortunately I can't use shift to select text while in insert mode. I can go back to visual mode though and do those types of operations.

Thanks again for your work on this plugin.

@mattferderer thanks for the feedback. basically the only thing keeping me from implementing ctrl-d is lack of a windows machine...

as for shift selecting text in insert mode, this is actually not a feature of vim (try it!). i strongly encourage you to use visual mode for whatever reason you were selecting text for. ๐Ÿ˜„

Curse us vim noobs who use this as a crutch! It's probably a good feature then to improve my Vim skills. ๐Ÿ‘

If there is anything I can do to help with the ctrl+d issue let me know. Though once I noticed the g+c thing in your readme, it solved my main issue. Might hurt new users adopting the plugin though who expect that to work. Now to to learn to be a better visual mode user, which will be helpful when using real vim.

hahha i like to joke about how every bug in vscode is just because you're not using vim correctly. ๐Ÿ˜‰ (tongue in cheek, of course ๐Ÿ˜„ )

and yeah, any and all help to get ctrl-d working on windows is appreciated. if you wanna dive into the code to see if you can get it, by all means! we (@xconverge and i) also try to be fairly responsive on slack (though im about to go to bed)

I work when he goes to bed so we have a 24 hour sweat shop of vimness

We should tric- err, recruit someone from London and we could really maximize our vim potential. 3 8 hour days every 24 hour cycle.

Sounds amazing. Who wants to draft a README addition.

What is the equivalent of Ctrl+K, Ctrl+D which skips a word and moves to next match when setting multiple cursors?

@mgutz @johnfn After doing gc, you can use Ctrl+K, Ctrl+D in normal mode, at least for me in VS Code 1.11/1.12 on Linux.

Ctrl-D will shift the current line to left when VSCodeVim in insert mode ๐Ÿ˜ข

I can use "Add Next Occurrence" in Normal and Visual Mode, but I cannot while I'm in Insert mode.

When I try to use "Add Next Occurrence" in Insert mode, it will correctly select the next word the first time I use it, but it maxes out at 2 cursors. Pressing it again causes the rest of the matching words to flash on the screen, but does not add any additional cursors. I have tried with both multiple keyboard shortcuts as well as the command from the menu bar, as well as changing the useCtrlKeys & handleKeys settings and the functionality remains the same, whether using Add Next Occurrence or the "gc" command.

Oddly enough, "Select All Occurrences" works fine and selects all matches in insert mode. I saw this issue that was closed (#1467), but I'm still seeing this exact issue on my machine. Should I open a new issue for this?

Selecting a word in insert mode then pressing cmd-d seems to be working as of 0.8.1!

@haolly That's because ctrl+d shifts the line left in Vim. If you want to add another cursor, use super+d, or use one of our options to go back to default VSCode behavior with the ctrl keys (handleKeys or useCtrlKeys). It's not a bug.

I try to highlight some text in insert mode and use Cmd-d but it does not carry the selection when adding another cursor.

cmd-d-not-working-insert

@cvharris This is a duplicate of this issue: #1705 (although admittedly, the title is hard to search).

You can replicate the intended behavior by simply selecting the selection with visual mode instead of with your mouse.

Getting an incredibly frustrating issue with multi cursor. I don't exactly have repro steps besides using it and trying to navigate within it sometimes. Is there an open issue on this?

vscode

@zebapy I have the same issue. I'm pretty sure the cause is the same breaking change by VSCode that caused the autocomplete issue.

I wrote up my questions there:
microsoft/vscode#28559 (comment)

Please open up an issue tracking multicursor. You'll note that this issue only occurs when the file has wordwrap or a fold above.

I've experienced an issue when I use snippets that automatically invoke multi-cursor mode, when delete some code, then later one doesn't delete anything while the previous one delete code in both forward and backward.

Here is the gif

@timle1029 One workaround I've found to work is to use ctrl+backspace when deleting.

idr4n commented

shift + v which normally selects the current cursor line does not work when in multi-cursor mode.

I discovered this problem, when trying out Multi-Cursor Mode, but I've since learned that it is present in other modes too, so don't hesitate to send me to a different issue/make a new one. In insert mode, I have new keybindings, namely

    "vim.insertModeKeyBindings": [
        {
            "before": ["j","k"],
            "after": ["<Esc>"]
        }
    ],

However, after adding the same to vim.otherModesKeyBindings and even vim.otherModesKeyBindingsNonRecursive for good measure, I can't use jk to get out of Visual Mode Multi-Cursor or even plain old Visual Mode, have to press <Esc> itself.

We should be able to go back to next match, jump over next match, additionally to select next match while pressing gb.

It's so bad that the mouse behavior is not supported while using vim plugin. I mean, you can create a cursor anywhere by clicking with the mouse, it could be nice to keep this while using vim plugin.

@Purgator I believe you can still create a cursor anywhere by clicking the mouse, no?

I can't with this plugin on.

@Purgator It still seems to work for me. alt-click works for me.

Not for me.


[purgator@legendance ~]$ code --version
1.15.0
8b95971d8cccd3afd86b35d4a0e098c189294ff2
[purgator@legendance ~]$ uname -a
Linux legendance 4.9.8-ARCH #1 SMP PREEMPT Wed Feb 8 18:08:18 CET 2017 x86_64 GNU/Linux

I'm experiencing weird behaviour using cmd+d from both normal and insert mode. Instead of adding the next occurrence of the word, it never goes past the second selection. In the gif below, I'm using the shortcut 4 times in each paragraph.

cmd d

It works as expected using g,b or by first selecting some text beforehand and then using the shortcut (last example in the gif). I'm using macOS Sierra with Vim 0.10.2 and VsCode 1.17.2

I'm sorry if this has been discussed already or if this is not the right place. I'm happy to add the comment somewhere else if needed.

wwqrd commented

Can I make Cmd+d use the built in behaviour?

I'm coming from Sublime Text and I really like how NeoVintageous handles this:

There two ways to use multiple cursors in Neovintageous.

The first is to enter insert mode, i, then use CTRL-D to make multiple
selections, press Esc to enter normal mode, from here you can use
NeoVintageous normally e.g. $ will jump the cursors to the end of line, ^
all cursors to the start of line, v enters all cursors into visual mode,
f{char} makes all cursors visually select to {char}, etc.

The second way is enter select mode, a non-standard mode that is used for
multiple selections. This mode is not the same as select mode in Vim.

gh                      Enter select mode (from normal or visual mode).
j                       Add selection.
k                       Remove selection.
l                       Skip current selection.
A                       Select all instances.
i                       Enter visual mode (preserving selections).
J                       Clear multiple selections and enter normal mode.
gH                      After a search with / or ? (select all matches).

Once you've created visual selections in select mode, you must return to insert
mode by pressing i in order to edit text. Once in insert mode, you can switch
to normal mode, etc. If you press Esc while in select mode, you will return to
normal mode, but multiple carets won't be destroyed. If you press Esc a second
time, you will be left with one single caret in normal mode.

Source

I find hitting gb each time is awkward. A single gb to enter select mode and then shortcuts for adding next, skipping, undoing, etc. would be very helpful.

Is this something the maintainers would consider?

@tansongyang Possibly in the future. FWIW, I've created a feature request for this: #2235, though It may be hard to implement and break a lot of things.
I've been enjoying gh mode in in my Sublime days and would love to see this feature come in VSCode's Vim.

In normal mode ctrl-D (in vim) is supposed to simply page down.

When I use ctrl-D I'm thrown immediately into Multicursor mode.

Does anyone know how to turn this off?

Trying to figure out if it's that vscode on mac is remapping ctrl to cmd somehow, but that isn't set anywhere in my settings. :-\

I've gone through all of the keybindings that reference both ctrl+d and cmd+d and shut them off and still I get this.

@Ryanglambert Adding this to settings fixed it for me somehow

"vim.handleKeys": {
    "<C-d>": true
},

@chazkim That it does!

Fhat commented

I had a slightly different issue to @Ryanglambert, I was getting put into visual mode every time I hit ctrl + D in normal mode, rather than getting the half page scroll. In case anyone out there has the same issue, adding the setting described in @chazkim's post fixed this for me.

Is this the issue to leave bugs concerning multiple cursors and vscodeVim?

jpoon commented

I'm going to close this issue as tracking issues reported here is getting a little tough. If you come across a bug, please file a new issue.

On linux, I had to remove the default keybinding for ctrl+d for this to work (to stop it being used for page down). This is despite configuring vscode to handle (or not handle ctrl+d). Perhaps the default "when" clause for that keybinding needs to change?

It would be helpful if the docs mentioned the keybinding for operating systems other than Mac :)

EDIT: On Linux at least, shift+alt+i (insert cursor at end of each line selected) works pretty well starting in visual mode, but appears to be a bit broken in visual line mode. This seems to be the easiest way to get one cursor per line.

screen capture on 2018-05-11 at 20-44-02
After using d-e to delete in multicursor mode, other cursors except the first one will disappear.

Hey @zhanglid , this issue has been noted here: #2632 (comment)

It will be fixed as of the next release. If this feature is important to you, I suggest staying on 0.11.5 until the next release goes out.

Cheers!

The most common feature I use is "Add cursor above/below"

Without vim, when I do this that spans multiple lines with an empty line in between, the cursor will maintain its position. For example let (cursor) represent a cursor

int t(cursor)est;
(cursor)
int t(cursor)est;

With vim enabled, the same functionality becomes this

int t(cursor)est;
(cursor)
(cursor)int test;

It would be really cool if this was fixed. Or if I'm doing something wrong please let me know! Thanks!

please implement vim-surround to work with multiple cursors.

After selecting multiple words with cmd-d, we are in visual mode, so technically shift-A should work as insert at the end of the selection. Currently after shift-A the insertion only happens at the end of the first selection. Thanks!

Hey, I'm trying to remap the multi cursor command to CTRL+n:

"vim.normalModeKeyBindingsNonRecursive": [
    {
      "before": ["<C-n>"],
      "after": ["g", "b"]
    }
]

The first usage selects the word under the cursor, but subsequent commands do nothing.

The behaviour is similar for other combinations involving the CTRL key, e.g., <C-e> again selects the word on first usage, but then starts scrolling down a single line (the default VIM behaviour).

Am I missing something?

Thanks,
Jens

I too have been trying to figure out how to emulate terryma/vim-multiple-cursors via ctrl-n. My fingers are having a hard time adjusting to cmd-d instead of ctrl-n since I've been using ctrl-n for years and still switch between vim and vscode.

After selecting multiple words with cmd-d, we are in visual mode, so technically shift-A should work as insert at the end of the selection. Currently after shift-A the insertion only happens at the end of the first selection. Thanks!

Same thing with me as well, pressing gb in normal puts in the visual mode and then running any vim command like affects only the first selection !! Is this a bug ?

After selecting multiple words with cmd-d, we are in visual mode, so technically shift-A should work as insert at the end of the selection. Currently after shift-A the insertion only happens at the end of the first selection. Thanks!

Same thing with me as well, pressing gb in normal puts in the visual mode and then running any vim command like affects only the first selection !! Is this a bug ?

Same issue for me. I'm on ubuntu if it makes a difference

Hey, I'm trying to remap the multi cursor command to CTRL+n:

"vim.normalModeKeyBindingsNonRecursive": [
    {
      "before": ["<C-n>"],
      "after": ["g", "b"]
    }
]

Thank you for bringing this to my attention @jefuba.
The reason it doesn't work is because you have add a binding for vim.visualModeKeyBindingsNonRecursive too:

	"vim.visualModeKeyBindingsNonRecursive": [
		{
			"before": ["<C-n>"],
			"after": ["g", "b"],
		},
	],

Thank you for bringing this to my attention @jefuba.
The reason it doesn't work is because you have add a binding for vim.visualModeKeyBindingsNonRecursive too:

Thank you so much!

mtjn commented

Hi, is it possible to change the default behaviour for the following situation?

Condition: multi-cursor insert mode
Action: press escape
Current result: change to multi-cursor normal mode

Desired result: change to single-cursor insert mode

when i move multiple cursors up or down the cursors will be merged as one cursor again, why is that?

When I am in multicursor insert mode I'd like to be able to highlight each word seperately like I would in non-vim multicursor mode. Is this possible?

Hi, is it possible to change the default behaviour for the following situation?
...
Desired result: change to single-cursor insert mode

Pls don't change the default, that proposed behavior would be annoying in my case. I don't care if it was behind some magic settings swtich though :)

I needed to add '<C-d>': false in vim.handleKeys in settings to make ctrl-d work the same as g b. Before that, I tried to just remove the keybinding for extension.vim_ctrl+d in keyboard preferences, which resulted in weird behavior.

Question: is there some equivalent of ctrl-k ctrl-d (skip this occurence and go to next one with the next cursor) with g something? Like g b is the equivalent of ctrl-d?

is there an equivalent of super-L with vscode vim? goal would be to drop into normal mode with cursors at the end of each lien

for example i paste some text from a website that includes line numbers

1. function someSample() {
2.     doStuff();    
3. }

without vim enabled, i'd do the follow

  1. super-a (select all)
  2. super-L (add cursors at end of all select lines)
  3. super-LEFT (move to start of line)
  4. alt-shift-right (select numbers)
  5. shift-right, shift-right (select ". ")
  6. delete (delete line numbers)
  7. esc (drop out of multi-line mode)

then i could get

function someSample() {
     doStuff();    
}

i realize visual block mode can do this to some extent, but my understanding is i only get one operator and then i'm back in normal mode where i entered visual mode

also realize i could do a macro and repeat on the lines, but i struggle to get those right the first time, and if i could skip doing the macro and go right to the normal commands, why not shorten the path a bit?

goal would be to

  • make some selection (not necessarily the whole file and same cursor location)
  • enter multi-cursor normal mode at the end of each line
  • multiple clip boards at each cursor
  • independent motion at each cursor

seems like the idea is present in the current implementation, just need a little easier route to drop into it

disclaimer: i'm a vim noob, apologies if i'm missing something obvious

@mtjn

Hi, is it possible to change the default behaviour for the following situation?

Condition: multi-cursor insert mode
Action: press escape
Current result: change to multi-cursor normal mode

Desired result: change to single-cursor insert mode

seems like the vim behavior of esc moving from insert to normal mode would supersede the more vs code behavior of esc dropping out of multi-cursor to single-cursor mode

maybe shift-esc would accomplish that? similar to paradigm of a and A, w and W` which result in a stronger form of the action?

@ralphcallaway are you talking about the Add Cursors to Line Ends hotkey? (it's shift-alt-i on my Linux) For me it works almost normally (adds the cursors as you said, then there's some vim error, but if I press esc it goes back to normal mode with the curors still at line ends). That takes care of your point 2 (point 1 is just plain selection). Alternatively, you can place the cursor on the first/last line, and use ctrl-shift-down/up to add another above/below. Note that if you used the selection method, you'll be in visual multi-cursor mode, so you need to press esc to go back to normal multi-cursor mode before point 3.

  1. I'm confused, on which platform does super-left do that? With the multiple curors in normal mode, you can thoughuse the plain old home button to go to line beginning. Or, using the vim way, press 0 to go to line beginning (or ^ to go to the first character in line).

4., 5. Still in normal mode, press v to go to visual multi-cursor mode, then just use the right key to select what you need. You can also use w in visual mode to select one word, t, to select until a comma, etc -- all vim motions work here.

  1. delete should work normally, or, the vim way, use d to cut the selection from visual mode (it can be even pasted in a different place, each cursor has its own clipboard).

@ralphcallaway are you talking about the Add Cursors to Line Ends hotkey? (it's shift-alt-i on my Linux) For me it works almost normally (adds the cursors as you said, then there's some vim error, but if I press esc it goes back to normal mode with the curors still at line ends). That takes care of your point 2 (point 1 is just plain selection). Alternatively, you can place the cursor on the first/last line, and use ctrl-shift-down/up to add another above/below. Note that if you used the selection method, you'll be in visual multi-cursor mode, so you need to press esc to go back to normal multi-cursor mode before point 3.

1. I'm confused, on which platform does `super-left` do that? With the multiple curors in normal mode, you can thoughuse the plain old `home` button to go to line beginning. Or, using the vim way, press `0` to go to line beginning (or `^` to go to the first character in line).

4., 5. Still in normal mode, press v to go to visual multi-cursor mode, then just use the right key to select what you need. You can also use w in visual mode to select one word, t, to select until a comma, etc -- all vim motions work here.

1. `delete` should work normally, or, the vim way, use `d` to cut the selection from visual mode (it can be even pasted in a different place, each cursor has its own clipboard).

@quezak that was exactly what i was looking for, thanks so much. super-left is a mac os x system convention, should have specified ...

now i realize i can search for "cursor" in the command palette and then use the keyboard shortcuts menu to track down the relevant hot key. ready to rock! thank you!!