Copy and cut in the vi editor in Linux, linuxvi

Source: Internet
Author: User

Copy and cut in the vi editor in Linux, linuxvi

In Linux, the vi editor implements simple copy and paste functions.


  1. If you want to paste the third line of content in the file to row 3:

    1. Enter your file (in command mode, not edit mode)

    2. Move your cursor to the beginning of your third line (with the direction key)

    3. Press v (you find that you have switched to visual mode) and press the arrow key to select the desired content.

    4. Press y and move the cursor to the end of the row 14th.

    5. Press p. Complete


  2. This method can be used to paste multiple rows-> copy

    If you want to cut-> copy, it will be simpler (it can only be used for single rows)

    1. Enter your file (in command mode, not edit mode)

    2. Move your cursor to the beginning of your third line (with the direction key)

    3. Double-click d (the third line is missing)

    4. move the cursor to the end of the row 14th and press p.



  3. Under the GUI: you can press I to enter the insert mode. Drag the mouse to select the content to be pasted, move the cursor to the position to be pasted, and press the middle mouse button (two keys can be clicked simultaneously ).

    In a plain text terminal:
    Select a text block and use v
    Copy the selected block to the buffer, and use y
    Copy the entire row, using yy
    Open the second file in the same editing window and use: sp [filename]
    Switch between multiple editing files, with ^ ww
    Cut block, with d
    Use dd to cut the entire row
    Paste the content in the buffer, and use p
    Add a number to the front of the command to indicate the number of repetitions, and add a letter to indicate the name of the buffer used.
    For help, use: help [content or command].


    END


How Can I copy the entire line of n in the linux Vi editor so that it can be pasted into the text?

1. Enter your file (in command mode, not edit mode)
2. Move your cursor to the beginning of your third line (with the direction key)
3. Press v (you find that you have switched to visual mode) and press the arrow key to select the desired content.
4. Press y and move the cursor to the end of the row 14th.
5. Press p. Complete
This method can be used to paste multiple rows-> copy ~!

If you want to cut-> copy, it will be simpler (it can only be used for single rows)
1. Enter your file (in command mode, not edit mode)
2. Move your cursor to the beginning of your third line (with the direction key)
3. Double-click d (the third line is missing)
4. move the cursor to the end of the row 14th and press p.

How Can I copy the entire line of n in the linux Vi editor so that it can be pasted into the text?

1. Enter your file (in command mode, not edit mode)
2. Move your cursor to the beginning of your third line (with the direction key)
3. Press v (you find that you have switched to visual mode) and press the arrow key to select the desired content.
4. Press y and move the cursor to the end of the row 14th.
5. Press p. Complete
This method can be used to paste multiple rows-> copy ~!

If you want to cut-> copy, it will be simpler (it can only be used for single rows)
1. Enter your file (in command mode, not edit mode)
2. Move your cursor to the beginning of your third line (with the direction key)
3. Double-click d (the third line is missing)
4. move the cursor to the end of the row 14th and press p.

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.