[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Vim question



On Sunday 23 October 2005 02.50, Paolo Pantaleo wrote:
> I just started learning python (i think it is great). Now i have the
> following problem:
> How can i comment 10 lines of code in a shot? That is, how can i add a
> # at the begenning of a range of lines?

I usually use a macro for this, but now I learn from the other replies 
that there are other more smart ways.. But just for the sake of it, here 
is what I would do.

Stand at the beginning of the first line you want to comment out.

qq                   (Start a new macro recording on q, qa would mean a)
i                    (Go to insert mode)
#                    (The character of your choice)
ESC                  (Get out from insert mode)
<go down one line>   (This needs to be part of the macro)
q                    (Stop the macro recording)
@9q                  (Play the macro 9 more times)


Kind regards

-- 
Olle Eriksson
mail@olle-eriksson.com | http://www.olle-eriksson.com



Reply to: