Fastest way to comment out a block of code in vim
Given this code that you want to comment out
var someFunction = function(){
some code I want
to
comment
out
}
And your cursor is at the first {
, you can type
-
v
visual editor mode -
%
go to the matching}
-
:norm I//
insert inline comments at the beginning of each line
// var someFunction = function(){
// some code I want
// to
// comment
// out
// }
Written by Duncan Wong
Related protips
2 Responses
I suggest to also look into the following vim plugin. https://github.com/tomtom/tcomment_vim
over 1 year ago
·
I think that plugin will change my life - thanks!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#