LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-10-2006, 08:16 PM   #1
blackzone
Member
 
Registered: Jul 2004
Posts: 256

Rep: Reputation: 30
Some vi question


I remember you can open multiple file with vi and switch between this files. How do you do it?

Also I remember you can make it a split windows and such.

Also I remember you can do bash commands under vi such as listing the files in a directory. how do you do it?
 
Old 07-10-2006, 08:41 PM   #2
jcorrea920
LQ Newbie
 
Registered: Jun 2006
Location: Oregon, USA
Distribution: Ubuntu / Fedora
Posts: 14

Rep: Reputation: 0
Cool Ctrl-Alt-F1

Why don't you just use another terminal screen and vi your second document there.

Ctrl-Alt-F1 Terminal 1
Ctrl-Alt-F2 Terminal 2
Ctrl-Alt-F3 Terminal 3
Ctrl-Alt-F4 Terminal 4
Ctrl-Alt-F5 X-Windows

You can toggle between terminals using these command. As far as vi commands, you may want to see the man pages for vi.
 
Old 07-10-2006, 08:47 PM   #3
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
Quote:
I remember you can open multiple file with vi and switch between this files. How do you do it?
Here are a couple of examples of that, don't know about the other questions.
Code:
Use yank (y) and paste (p) to copy data from file.txt into file1.txt.
1:	vi file.txt		# Open a file
2:	:1,4y              	# Copy lines 1 thru 4
3:	:e! file1.txt	        # This opens up the second file
4:	p                   	# Paste the buffer into the second file
5:      :w!			# Save changes to second file
6:      :e! file.txt     	# Return to the first file

Search for a pattern, then
use yank (y) and paste (p) to copy data from file.txt into file1.txt.
1:	vi file.txt		# Open a file
2:	/now            	# Search for now
3.	y3w			# Copy three words from the search position.
4:	:e! file1.txt	        # This opens up the second file
5:	p                   	# Paste the buffer into the second file
6:      :w!			# Save changes to second file
7:      :e! file.txt     	# Return to the first file
 
Old 07-10-2006, 09:27 PM   #4
blackzone
Member
 
Registered: Jul 2004
Posts: 256

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by jcorrea920
Why don't you just use another terminal screen and vi your second document there.
mainly for quick copy and pasting
 
Old 07-11-2006, 12:28 AM   #5
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,311

Rep: Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040
1. give vi a wildcard to edit eg
vi *.pl
then use
:n
cmd to move through 1 buffer per file

2. see http://www.worldtimzone.com/res/vi.html

3. use the
:shell
cmd to shell out and run cli cmds, then type
exit
to rtn to editor
 
  


Reply

Tags
vi


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
Question, Apples Contribution to Open Source + MacOs file structure question Higgy3k Other *NIX 5 07-25-2005 05:23 AM
Not your regular GRUB question - just a short question for a fried MBR!! ziphem Linux - General 3 01-31-2005 02:51 PM
login prompt question & kde scheme question JustinCoyan Slackware 2 06-09-2004 03:02 PM
RE: Suse 8.0 hardware question {newbie question, pls help} Radiouk Linux - Distributions 2 06-04-2002 01:53 PM
Lilo/kernel question & font question phek Linux - General 9 09-18-2001 01:20 PM


All times are GMT -5. The time now is 04:40 PM.

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