Vim: Select All Occurrences returns cursor to starting mode.

Created on 28 Sep 2017  ·  11Comments  ·  Source: VSCodeVim/Vim

  • Click thumbs-up 👍 on this issue if you want it!
  • Click confused 😕 on this issue if not having it makes VSCodeVim unusable.

The VSCodeVim team prioritizes issues based on reaction count.


Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Environment:

  • VSCode Version: 1.16.1
  • VsCodeVim Version: 0.10.1
  • OS: macOS Sierra (10.12.6)

What happened: VSCode Select All Occurrences command (⇧⌘L on macOS) was performed on a selection. A cursor was created for each matching instance of the current word, but the cursors did not stay in Visual mode.

VSCodeVim enabled:

enabled

VSCodeVim disabled:

disabled

What did you expect to happen: All matching instances of the word should be selected and remain in Visual mode.

How to reproduce it: Create a file with multiple matching instances and perform the Select All Occurrences command.

aremulticursor areselection help wanted kinbug

Most helpful comment

I actually prefer the way amVim handles—Add multi-cursor to all occurrences (CTRL+SHIFT+L) — goes into Insert mode.

All 11 comments

A similar issue occurs when using the Python mode and selecting "Change All Occurrences".

@xconverge

I performed a quick investigation. Unfortunately, I think this is another bug hiding in the modeHandler.handleSelectionChange() method.

https://github.com/VSCodeVim/Vim/blob/09ea88578d631f9aeb26969738c2512d46075322/src/mode/modeHandler.ts#L648-L666

This if statement is evaluated to true because the selections changed and because the mode is not VisualBlock. However, this if statement does not update this.VimState.CurrentMode, which needs to change from Normal (or whatever it started as) to Visual. I'm pretty sure this is performed later in handleSelectionChange(), we just never reach it due to the return.

This theory is supported by the fact that, if the starting mode is Visual mode, regardless of how much of the current word is selected, the Select All Occurrences command behaves correctly.

Any news on this one?

There is not practically one editor that has this functionality working properly apart from sublime so sad :/, and even sublime text hasn't fully implemented multi cursor for vim mode.

I actually prefer the way amVim handles—Add multi-cursor to all occurrences (CTRL+SHIFT+L) — goes into Insert mode.

@J-Fields maybe this is mislabeled - maybe it should be under area/multicursor?

Can someone reproduce this on mac today? I could not; the feature works as expected running win7.

The feature does not work properly for me on Ubuntu 20. If I choose "Change All Occurences" it puts into NORMAL mode and I can't get into INSERT mode to edit the text.

@brettins Are you using the latest version 1.18.5?

Using "Change All Occurrences" should select all occurrences and put you in -- VISUAL -- MULTI CURSOR mode. Then if you want to change to a completely different word press c to change all of them at the same time, if you want to append to the word press A or if you want to prepend press I.

This is how it works for me on Windows 10.

Ah, yep, that's the way it works, not sure why I thought it was in NORMAL when it clearly isn't. My apologies!

Once we manage to implement SelectMode we can, in situations like this, go into multicursor SelectMode and the experience will be even better.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gerardmrk picture gerardmrk  ·  3Comments

AndersenJ picture AndersenJ  ·  3Comments

WangRongda picture WangRongda  ·  3Comments

ACollectionOfAtoms picture ACollectionOfAtoms  ·  3Comments

cckowin picture cckowin  ·  3Comments