Re: RE: vi set comment #

2009-02-21 Thread af300wsm

On Feb 20, 2009 7:56am, Johan Hendriks  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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: vi set comment #

2009-02-20 Thread Javier Perez
2009/2/20 Rajarajan Rajamani :
> On Fri, Feb 20, 2009 at 9:52 AM, Doug Poland  wrote:
>> Johan Hendriks wrote:
>>>
>>> How can i in vi set a # on multiple Lines to comment out some text.
>>>
>>> I know it must be a simple thing but i can not seem to get it right.
>>>
>>> Like in a config file i have the following
>>>
>>> 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 for your time
>>> Regards,
>>> Johan
>>
>>>
>>
>> This question is really more germane to a VIm mail list
>> (http://www.vim.org/) , but I'll tell you how'd I'd do it.
>>
>> First, turn on line numbers --
>>
>>   :set nu
>>
>
>>   :3,8s/^/#/
>>
>> That's all there is too it.  BTW, VIm help is your friend
>>
>
> OR just mark the block visually and then do a
> :'<,'> s:/^/#/
>
> the '<,'> will appear automatically as soon as you hit : after marking
> the visual block.

On vim you can also use a keyboard macro in this way:

1G   (or whatever the line you wanna start from)
qa^i#jq (the macro itself)
5...@a(as many times you need)


Cheers.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: vi set comment #

2009-02-20 Thread Rajarajan Rajamani
On Fri, Feb 20, 2009 at 9:52 AM, Doug Poland  wrote:
> Johan Hendriks wrote:
>>
>> How can i in vi set a # on multiple Lines to comment out some text.
>>
>> I know it must be a simple thing but i can not seem to get it right.
>>
>> Like in a config file i have the following
>>
>> 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 for your time
>> Regards,
>> Johan
>
>>
>
> This question is really more germane to a VIm mail list
> (http://www.vim.org/) , but I'll tell you how'd I'd do it.
>
> First, turn on line numbers --
>
>   :set nu
>

>   :3,8s/^/#/
>
> That's all there is too it.  BTW, VIm help is your friend
>

OR just mark the block visually and then do a
:'<,'> s:/^/#/

the '<,'> will appear automatically as soon as you hit : after marking
the visual block.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


RE: vi set comment #

2009-02-20 Thread Johan Hendriks
>> How can i in vi set a # on multiple Lines to comment out some text.
>> 
>> I know it must be a simple thing but i can not seem to get it right.
>> 
>> Like in a config file i have the following
>> 
>> 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 for your time
>> Regards,
>> Johan 
 >>

>This question is really more germane to a VIm mail list 
>(http://www.vim.org/) , but I'll tell you how'd I'd do it.

>First, turn on line numbers --
>
>:set nu
>
>The you'd see something like --
>
>  1
>  2
>  3   define service{
>  4   use generic-service
>  5   host_name   w2003hk03
>  6   service_description Explorer
>  7   check_command   check_nt!PROCSTATE!-d SHOWALL -l
>  8   }
>  9
> 10
>
>Then replace the beginning of a line with a # symbol --
>
>:3,8s/^/#/
>
>That's all there is too it.  BTW, VIm help is your friend
>
>:help replace
>
>
>--
>Regards,
>Doug

Thanks all for the fast and usefull response.

Regards,
Johan Hendriks


No virus found in this outgoing message.
Checked by AVG - www.avg.com 
Version: 8.0.237 / Virus Database: 270.11.1/1962 - Release Date: 02/20/09 
07:26:00
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: vi set comment #

2009-02-20 Thread DAve

Johan Hendriks wrote:

How can i in vi set a # on multiple Lines to comment out some text.

I know it must be a simple thing but i can not seem to get it right.

 

 


Like in a config file i have the following

 


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.



http://lmgtfy.com/?q=comment+multiple+lines+in+vi

Don't take this personal. I've been dying to use that link for over two 
weeks. Normally my tech support staff provides me ample opportunities, 
but they have been quiet lately. ;^)


DAve

--
"Posterity, you will know how much it cost the present generation to
preserve your freedom.  I hope you will make good use of it.  If you
do not, I shall repent in heaven that ever I took half the pains to
preserve it." John Quincy Adams

http://appleseedinfo.org

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: vi set comment #

2009-02-20 Thread Doug Poland

Johan Hendriks wrote:

How can i in vi set a # on multiple Lines to comment out some text.

I know it must be a simple thing but i can not seem to get it right.

Like in a config file i have the following

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 for your time
Regards,
Johan 

>

This question is really more germane to a VIm mail list 
(http://www.vim.org/) , but I'll tell you how'd I'd do it.


First, turn on line numbers --

   :set nu

The you'd see something like --

 1
 2
 3   define service{
 4   use generic-service
 5   host_name   w2003hk03
 6   service_description Explorer
 7   check_command   check_nt!PROCSTATE!-d SHOWALL -l
 8   }
 9
10

Then replace the beginning of a line with a # symbol --

   :3,8s/^/#/

That's all there is too it.  BTW, VIm help is your friend

   :help replace


--
Regards,
Doug
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


vi set comment #

2009-02-20 Thread Johan Hendriks
How can i in vi set a # on multiple Lines to comment out some text.

I know it must be a simple thing but i can not seem to get it right.

 

 

Like in a config file i have the following

 

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 for your time

Regards,

Johan 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"