LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-31-2007, 02:43 AM   #1
culin
Member
 
Registered: Sep 2006
Distribution: Fedora Core 10
Posts: 254

Rep: Reputation: 32
vim


Hi all,
can anyone tell me is there any command in vi editor to "select all" other than typing number of lines and yy
 
Old 01-31-2007, 03:08 AM   #2
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Try pressing V on your first line, then G to mark all text. Remember it is "V" and "G" not "v" or "g" ^_^;;
 
Old 01-31-2007, 03:10 AM   #3
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Oops sorry... that will not work on vi, because vi does not have visual mode. Now, if you are using vim (which is far better - pun indented), it should work.

Regards!
 
Old 01-31-2007, 03:11 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If you want to do something like a search & replace over the entire document for example, use '%' for the range:
:%s/ thier/ their/g
 
Old 01-31-2007, 03:27 AM   #5
culin
Member
 
Registered: Sep 2006
Distribution: Fedora Core 10
Posts: 254

Original Poster
Rep: Reputation: 32
oh.. wow.. its working....Thanks Mega Man X
and after marking with G i have to yank right ?? "yy"
 
Old 01-31-2007, 03:42 AM   #6
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Np. Always a pleasure to help another Linux and Vim enthusiast

Regards!

EDIT: oops. Yup, yank after. I can't test it now, but I think that if you yank, you will automatically leave visual mode. If you want to paste it, you will need to enter visual mode again (press v). i could be wrong though

EDIT2: tested. You don't need to be on Visual mode to paste, once you've "yanked"

Last edited by Mega Man X; 01-31-2007 at 03:47 AM.
 
Old 01-31-2007, 06:06 AM   #7
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
to yank a whole file

yG

edit
sorry assuming you are at line 1.

otherwise:

1GyG

Last edited by bigearsbilly; 01-31-2007 at 06:07 AM.
 
Old 01-31-2007, 06:36 AM   #8
culin
Member
 
Registered: Sep 2006
Distribution: Fedora Core 10
Posts: 254

Original Poster
Rep: Reputation: 32
Thanks for all replies....
 
Old 01-31-2007, 11:12 AM   #9
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
Quote:
Originally Posted by Mega Man X
... that will not work on vi, because vi does not have visual mode.
vi doesn't have visual mode? What do think "vi" is short for? Hint: "visual editor". Use the ex variant to disable visual mode.
 
Old 02-01-2007, 02:01 AM   #10
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Quote:
Originally Posted by eddiebaby1023
vi doesn't have visual mode? What do think "vi" is short for? Hint: "visual editor". Use the ex variant to disable visual mode.
Did you actually understand what I was trying to say or did you just feel like explaining what "vi" means? Vi does not have a Visual Mode. Vim does. You enter Visual Mode when pressing the "v" key, when not on Command Mode, Insert or Append mode. This feature was added in VIM. You may have your vi editor symlinked to vim, as most distros do, so when you type "vi", you are actually using "vim".

I just started vi in my machine and pressed "v" and I get: "v isn't a vi command".
 
  


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
encryption with Vim (vim -x) mikshaw Linux - Software 2 03-07-2007 09:00 AM
LXer: Vim tips: Using Vim mappings and abbreviations LXer Syndicated Linux News 0 06-18-2006 01:54 PM
LXer: Cream for Vim - Making Vim more user friendly LXer Syndicated Linux News 0 06-17-2006 11:54 PM
Vim Richlw Linux - Software 2 07-06-2005 02:21 PM
Vim Maurice Arthur Linux - General 6 01-06-2004 02:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:04 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration