LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-18-2006, 05:21 AM   #1
newbloggy
LQ Newbie
 
Registered: Apr 2006
Posts: 10

Rep: Reputation: 0
commenting more than one line in VI editor


# is used to comment a line in vi editor. Can anyone help me by saying the command to comment selected number of lines in VI editor. To replace the text "hi" with "hello" in the entire file I used:

:1,$s/HI/HELLO)/g
the above command. Like this i want to comment various lines in my program. How to do this??????
 
Old 04-18-2006, 07:09 AM   #2
berbae
Member
 
Registered: Jul 2005
Location: France
Distribution: Arch Linux
Posts: 540

Rep: Reputation: Disabled
Put the cursor to the first line of the selection you want to comment out, and mark it by typing ma,
then go to the last line of the selection and mark it by mb, then use the command:
:'a,'bs/^/#/
you can also just put the cursor to the last line of the selection without marking it, and use:
:'a,s/^/#/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
php commenting, and api generation dakomoon Programming 2 12-11-2005 11:13 PM
proper commenting in C joesbox Programming 6 02-13-2005 11:11 PM
vi editor/command line free guide fhameed Linux - Software 3 12-12-2003 09:16 AM
VI text editor in command line InSane103 Linux - Software 4 07-09-2003 09:04 PM
vi as Command Line Editor taz75 Linux - Newbie 8 01-04-2002 01:30 PM


All times are GMT -5. The time now is 11:36 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration