Vscode-neovim: Commenting multiple line in visual mode inserts extra slashes

Created on 11 Dec 2019  路  5Comments  路  Source: asvetliakov/vscode-neovim

First of all, excellent project!

The visual mode adds multi cursors automatically, when I select multiple lines and commenting with cmd+/, two sets slashes will be inserted and cannot uncomment once.

I hardly use multi-cursors before, so I'm not sure adding multi-cursor as a default behavior is suitable for most users.

bug

All 5 comments

Related to #59 & #61 . Multi-cursors will be disabled by default in next version

Is there a way to comment with multi cursors enabled?

@codeincontext
Try these mappings:

xmap gc  <Plug>VSCodeCommentary
nmap gc  <Plug>VSCodeCommentary
omap gc  <Plug>VSCodeCommentary
nmap gcc <Plug>VSCodeCommentaryLine

then gc while being in visual mode should do the trick.

Unfortunately this is not fixable due to cursor pos differences. In vscode cursor pos is actual before the character, in vim it's on character. This is not problem for right-2-left visual selections but for left-2-right one character is not being selected due to this. I'm workarounding this problem by creating second selection for 1 right character, that's why commenting through vscode command produces multiple comments (because there are 2 cursors on line for left-2-right visual selection).

The solution is not to use builtin vscode comment key and use xmap gc <Plug>VSCodeCommentary bound to some key.

As workaround i'll remap <C-/> to call VSCodeCommentary

@asvetliakov great, that's really helpful. Thank you for taking the time to investigate 鈿★笍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mizagog picture mizagog  路  5Comments

DrakeXiang picture DrakeXiang  路  4Comments

asvetliakov picture asvetliakov  路  5Comments

zeljkofilipin picture zeljkofilipin  路  3Comments

anhyeast picture anhyeast  路  5Comments