

I added a mapping to normal and visual modes, but you can remap to anything you like. You simply add a new filetype to the comment_map and its comment leader. vimrc file which works pretty well and can be extended easily. I've come up with a simple addition to my. (Thanks to and for improvements incorporated into this answer) Note 3: Bare-bones vim sometimes doesn't have the norm command compiled into it, so be sure to use the beefed up version, ie typically /usr/bin/vim, not /bin/vi Eg putting the following line in ~/.vimrc lets you type ctrl-n instead of :norm after making your visual selection vnoremap :norm If it moves smoothly, then you have enabled it successfully.

3.Now press and hold k to see if your cursor goes up. 2.Press i to get into 'insert mode' and hit enter like 4-5 times to move the cursor down. Note 2: You could of course also add a mapping if you find yourself using norm a lot. 1.Create a new file on VS Code Now you can see the cursor is a bit wider than before. If you need the escape character as part of your command sequence, type ctrl-v then hit the escape key (or even easier, just record a quick macro and then use norm to execute that macro on each line). Note: Since norm is literally just executing regular vim commands, you're not limited to comments, you could also do some complex editing to each line. Note that unlike block selection, this technique works even if the comments have uneven indentation! Which means "go to the first non-space character, then delete one character". If the comments are indented as in the OP's question, then you can anchor your deletion like this: :norm ^x If I had used a 2-char comment such as // then I'd simply do :norm xx to delete both chars. This deletes the first character of each line.

visually select the text as before (or type gv to re-select the previous selection) Note that when you type : the range will be filled in, so it will really look like :'norm i# This inserts "#" at the start of each line. visually select the text rows (using V as usual) In these cases a low-tech alternative is the built-in norm command, which just runs any arbitrary vim commands at each line in your specified range. vimrc cannot help me, or sometimes NerdCommenter gets it wrong (eg JavaScript embedded inside HTML). Sometimes I'm shelled into a remote box where my plugins and.
