Go VI Copy between documents

Source: Internet
Author: User
Tags add numbers

(Note: This article is reproduced from the Internet, Source: http://hi.baidu.com/349426204/blog/item/cab88e342b61783e5ab5f5f6.html)


Everyone in the VI editor, often encountered to want to file a one or more lines inside, copy to B file inside
(Maybe a lot of people don't know what to do), how to do it.
Here are a few of the methods:
1. If you have more than one machine, and is networked, you can use the Netterm virtual terminal, Telnet Landing host to a file to modify, copy, and then open the B file pasted past.
2. If it is a stand-alone machine, of course, the use of Unix with its own editing function?
First, a brief introduction to some of the VI Editor's command:
(a). YW the current word into a nameless buffer, preceded by a "X", indicating that the name of the named X is stored
Buffer (x is a-Z), can also add numbers to the number of words deposited, later available p or P life
Order to remove
YY stores the current line in a nameless buffer, see YW

(b). The order is as follows: A-Z is a buffer and can also remove the deletion buffer specified by the number 1-9
Using a named buffer saves a good number of text segments for later access, movement, or rearrangement. These buffers are named with A to Z letters. To access one of these buffers, use double quotes
For example, to insert a line into a buffer, type:
"Ayy
To put this text back in the file, type "AP


(c). m to make a mark order:
The M letters mark the current line with letters, and then use the ' letter to move the cursor to the current line.
(see ' Command ')

The following: 1. 4 lines in a file to B file

The order is as follows: "ay4+
: Ex B (go to B file)
Then the AP
2. Copy multiple lines in a to B file
First sign at the beginning, Mk.
Then at the end with "Ay ' k" (the cursor automatically back to the beginning, this time already put your content in the buffer)
Where a represents buffer a
Then use the ex to escape to your file B, and then paste it with the AP command.

3. If you have multiple copies of your file to copy and paste, look at the following:
A indicates buffer A, do you still want to use buffer B?
Buffer has a A-Z and 1-9 so many
The buffer is like the fried version of Windows, it has a lot of good, you can copy you want to go in, and then paste, but you use "ay Time to change A is, if you want to copy 462 lines with" Ay, copy 536 lines with "by

//*******************************

copy and Paste command-line commands

1 Enter at command line: Set-o VI
You can manipulate the command line like Operation VI

2 Command Line Input:

Chkconfig gpm On
Service GPM Restart
And then:
Select with the mouse is copied, and then press the middle button or the wheel is pasted


Ps:

See a way to replicate between multiple documents using Gvim under the Linux GUI interface.

http://www-128.ibm.com/developerworks/cn/linux/l-tip-vim1/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.