VSCodeVim / Vim

:star: Vim for Visual Studio Code
http://aka.ms/vscodevim
MIT License
14.02k stars 1.32k forks source link

`<D-d>` fails for single character words in normal mode #3395

Open benlindsay opened 5 years ago

benlindsay commented 5 years ago

First, thanks to all contributors for making this plugin what it is! This makes my VSCode experience much more pleasant. OK here's the bug report:

Describe the bug CMD-D works well to select multiple words for multi-character words in both normal and insert modes, and it works in insert mode for single characters, but in normal mode, when the cursor is over a single character word and I push CMD-D, I can't get multiple cursors to display.

To Reproduce Steps to reproduce the behavior:

  1. Type a a a somewhere
  2. Enter normal mode
  3. Place cursor over an a
  4. Type <CMD-D>
  5. Observe lack of multiple cursors

Expected behavior Multiple selections appear over all matching single character words

Screenshots cmd_d

Environment (please complete the following information):

===UPDATE===

Even doing the replace on a single selected character is flawed because it searches for any instance of that character, rather than isolated instances of that character. Example in action:

vscode_replace

joshhepworth commented 5 years ago

Environment (please complete the following information):

Extension (VsCodeVim) version: 1.1.0 VSCode version: 1.31.1 OS: macOS 10.14.3

benlindsay commented 5 years ago

@joshhepworth are you confirming that you see the same problem? I see the same problem still with VSCodeVim version 1.1.0 and the latest VSCode version 1.32.1 too.

joshhepworth commented 5 years ago

@benlindsay I am yes – sorry that was unclear.

I wanted to just make sure this was visible and provide more information to whoever might end up debugging this.

samselikoff commented 4 years ago

@benlindsay ever find a workaround for this? It affects me many times a day!

Is there an easy way in vim to select in insert mode, or possibly when pressing CMD-D switch the mode to insert, then multiselect, then back to normal?

benlindsay commented 4 years ago

@samselikoff No, unfortunately I still don't have a workaround for this, other than avoiding single-character variables, and if I have single-character variables, avoiding renaming them.

benlindsay commented 4 years ago

However, I do have some bad news: even the single character, insert-mode selection is flawed as shown in the updated initial post above

samselikoff commented 4 years ago

For me it's usually not single char variables, it's things like

<p>
  Hello
</p>

and wanting to grab the p and change it to a div.

benlindsay commented 4 years ago

Yeah unfortunately my strategy doesn't always work. Would really like this to be fixed for use cases like those.

As a side note though, for that very specific use case, it looks like there's another package that does that if that's something you do often enough to warrant an additional package: https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-rename-tag

atomkirk commented 4 years ago

also experiencing this. Would love to see fixed! 🙇