Fabulous, thank you. There seems to be extraneous 'i's in the two
examples you provided; "ia*/" puts 'a*/' at the end of the comment.
Never knew that `< and `> jumped around in the visual block, thank you!


-----Original Message-----
From: Yakov Lerner [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 05, 2006 11:45 AM
To: Max Dyckhoff
Cc: vim@vim.org
Subject: Re: Commenting out a block of text

On 5/5/06, Max Dyckhoff <[EMAIL PROTECTED]> wrote:
> F4 I want to do a block comment, namely put /* at the beginning of the
> selection and */ at the end. Currently I am using a massive hack for
> this (xi<HOME>/*<CR><HOME>*/<CR><up><up><esc>p) but was wondering if
> there was anyway of doing a search and replace for an entire block,
> something like
> :s/start_of_visual_selection(.*)end_of_visual_selection/\/*\1\/*/

Try along the lines of
    :map <f4> <esc>`>ia*/<esc>`<i/*<esc>
    :map <f4> <esc>`>iA<cr>*/<esc>`<O/*<esc>
depending on your needs. (all untested). This
came up recently in the list.


Reply via email to