陈方荣 wrote: > --- > Best regards > 陈方荣 > >> -----邮件原件----- >> 发件人: Tim Chase [mailto:[EMAIL PROTECTED] >> 发送时间: 2007年4月13日 :09:44 >> 收件人: Ricky Zhou >> 抄送: 陈方荣; Vim >> 主题: Re: [Help]How can I add some char before a block? >> >> >>>> How can I add some char before a block? Just like C++ >>>> comment. >>>> >>> Use V to select the block you want, then type :s/^/\/\// >>> >> You can make this a little easier/shorter to type by using >> >> :s!^!// >> >> The alternative delimiters (you can use a variety of characters, >> though I tend to choose "!", "@", or "#") allow you to include >> certain characters without concern for having to escape the >> primary delimiter. >> >> There's also blockwise-visual mode: >> >> :help v_b_I >> >> which can also be an easy/lazy way to do it, especially if you're >> already in blockwise-visual mode. >> >> -tim >> >> >> >> > > It's work. > Thanks. > > > > > I usually use V to select a block and then use :normal i// to do the insertion, which may be easier if you type `normal' faster than the :s commands.
OTOH, I also use :%s/\s\+$// to remove all trailing spaces in files. -- Happy vimming!