linux-vim/Editor

Source: Internet
Author: User

This contact should be at 37, since it is necessary to modify the service time of some servers

This part should belong to the focus, about the VI of a lot of things, seemingly out of a few books specifically about VI. There are cows who use this program super fast. For most of us, it's OK to use them.

Vim/vi is a powerful screen text editor, the most commonly used text editor on Linux and UNIX, and it is the function of creating, editing and displaying text files. vim/vi no menus, only commands. VI is case sensitive. Be careful not to confuse when you enter a command .    for ease of operation, we operate on a copy of a file with content. [[email protected] test]# cp/etc/services services.test Copy the/etc/services file to the current directory. Vim is a reinforced version of VI, when a lot of users are still accustomed to using VI to edit files[[email protected] test]# Vim services.test Enter file three modes of conversion:Enter a, I, O into the insert mode in command mode Press ESC to enter Command mode in insert mode Command mode input: (colon) into edit mode instruction Error in edit mode returns Command mode  Do not feel a bit around, in fact, we just remember, vi into the file, press I key can be edited on the file. when the edits are complete, press the ESC key to exit edit mode. The exit must be remembered in three. : Q is exited (when the file has not changed): q! Do not save the exit (when the file changes): Wq Save and exit Vim/vi  Learn some of the commands below to help us quickly edit and use VI   Command mode:The command mode mainly uses the direction key to move the cursor position to edit the text, the following list the common Operation command and the meaningThe upper, lower, left, and right keyboards and H, J, K, l keys are all moving cursors respectively. $------------Move to end of line0 (0)-----Move to the beginning of the lineH----------Move to upper screenM----------Move to the center of the screenL----------Move to the bottom of the screenGG---------to the first line of the fileG----------to end of filePagedn--- Move down one pagePageUp--- Move up one paged+ Arrow key ----delete textDD--- Delete entire linePP--- full line replicationR---Modify the character of the cursorS---Delete the column where the cursor is located and enter the input mode Insert mode:  You can enter "Insert mode" from "Command mode " by the following commanda------------append text after the labelA------------Additional text at the end of our linei-------------insert text before the cursorI-------------Insert text at the beginning of the banko------------Insert a new line under the cursorO-----------Insert a new line on the cursor ESC--------exit "Insert Mode" edit mode:
Editing mode mainly for some text editing aids, such as String search, substitution, saving files and other operations.
: Q---end VI program, if the file has been modified, save the file first:q! ---Mandatory Exit VI program : Wq---- Save the changes and exit the program: Set Nu---Causes the line number to appear before each line of text: Set Nonu------The line number before each line is canceled: N------------to Nth row

The best way to learn VI is to follow vimtutor, you can enter the following command after connecting SSH
vimtutorHere are a few common commands that are very useful for beginners
All need to run in command-line mode, and that's when you press ESC.

Open a file with VI
Only need to enter the VI space file name
vi filenameOpen if it exists, create it if it does not exist

Jump to a line
Uppercase G jumps to the last line
GThe first line is 1G or GG.
1GIf you love playing War3, you might prefer to enter both small g
gg
Roll around in VI.
Of course you can use arrows up and down around ... But
Lazy programmers are not good programmers,
In addition to lazy with the mouse, the keyboard is too long, I do not shake wrist pinch

    • Input h Move left
    • Input l Move right
    • Input k Move Up
    • Input J Move Down

You'll find that you can also use JK to flip articles in Google Reader ...

Search in VI
If you want to search the Rennes, you can use the "/"
/早川濑里奈Search Next is next, you just need to enter N
nYou'll find that you can also use/search in Google Reader ...

Exit VI
Exit but do not save
:q!

Exit and save
:wq

linux-vim/Editor

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.