vi set comment #

af300wsm at gmail.com af300wsm at gmail.com
Sat Feb 21 06:50:26 PST 2009


On Feb 20, 2009 7:56am, Johan Hendriks <Johan at double-l.nl> wrote:


> >> define service{

> >> use generic-service

> >> host_name w2003hk03

> >> service_description Explorer

> >> check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe

> >> }

> >>

> >> And now i want to set a # to all the 6 lines.


> Thanks all for the fast and usefull response.



> Regards,

> Johan Hendriks


As if you haven't already gotten enough help and such, I'd like to give you  
another alternative that will be handy in the future too. Please note  
however that this only applies if you're using VIM.

1) Place your cursor on top of the first character you want to put the  
comment in front of (in your example, which I left above, that would on top  
of the 'd' in "define")
2) Hit Ctrl-v (this places the editor in visual mode)
3) Hit 'j', or use the down arrows, until your highlighted section is on  
top of the last character you want the comment in front of (in your  
example, it is the closing '}')
4) Hit Shift-I
5) Type a single '#'
6) Hit escape

After hitting escape, you'll have a new column of '#' characters in front  
of every character in that vertical column. Also, one of your first  
respondents mentioned a mailing list at vim.org (I believe, going off  
memory), you can also get great vi/vim advice from comp.editors. They  
discuss all kinds of editors there, but the group is mainly vi dominated.

Hope this helps,
Andy


More information about the freebsd-questions mailing list