I often see other bloggers talking about vi and I want to jump up and down and demonstrate how to do what they're talking about, but without the pain of using vi-ish ways.
What Brad suggests doing in vi is something along the lines of:
- Go to where you want the comment block to start
- Hit
mm
- Go to where you want the comment block to end
- Hit
mn
- Type
:'m,'ns/^/#/
The two techniques that are possible in vim, which are both reasonably good, but I like the second one best are:
- Go to where you want the comment block to start
- Hit
v
- Go to where you want the comment block to end
- Hit
:s/^/#/
:
will make vim automatically enter in the code that means "from the mark which is the start of the visual block to the mark that is the end of the visual block", or :'<,'>
. This will essentially do the same thing as what Brad suggests, but using visual mode instead of manual marking.The second technique, which as I mentioned, is my preferred one, is using Visual Block mode.
- Go to where you want the comment block to start
- Press Zero
0
so that you will be in the very first column - Press
Control-v
- Go to where you want the comment block to end
- Press
I#<esc>
#
(or whatever other text you wish to insert) at the beginning of each of those lines.Even better, using the last technique I showed you, you can uncomment the same code by selecting the comments in the same way (using
Control-v
) and hitting x
to delete them.
3 comments:
You are such a nerd!
Please don't talk about issues being 1980. I sit on my desk all day and wondering about computer stuff, and it simply doesn't make me feel very well.
yours, justus
These techniques that are being used by the professional and I am pretty aware with them. It sure has been the most interesting fact that you have been talking about in this post.
Amazing sharing, thanks for sharing with the online community. sniper 3d assassin mod download epsxe downlaod gta san andreas mod download
Post a Comment