Talking about VIM

Source: Internet
Author: User

First, the basic introduction
Vim (vi improved) as the name suggests is the modified version of VI, then what is VI?
VI is a commonly used in Gnu/linux under the editor, with the continuous expansion of demand, on the basis of the vi made a lot of improvements, so Vim was born.
These advantages of vim in relation to VI are mainly reflected in the following aspects:
1, multilevel undo we know in VI, press u can only undo the last command, and in Vim can be unlimited undo.
2, the ease of Use VI can only run in Unix, and vim can not only run in Unix,windows, Mac and other multi-operation platform.
3, syntax highlighting vim can be used in different colors to highlight your code.
4, visual operation means that vim can not only run at the terminal, but also can run on X window, Mac OS, Windows.
5. Full compatibility with VI in some cases, you can use Vim as VI.
This shows that VIM is a very powerful and popular text editor.
Official website: http://www.vim.org/
Installing Vim-minimal packages under Linux
If you are under Linux, you can install vim-enhance to extend it to the full version of Vim

Ii. Overview of the whole
There are three modes in the Vim editor
1. General mode:
Entering the "Vim file name" in the Linux terminal enters the general mode, but cannot enter text.
2. Edit mode:
In general mode Press I will enter the editing mode, at this time you can write the program, press ESC to return to the general mode.
3. Command mode:
In general mode Press: will enter the command mode, there will be a colon in the lower left corner, the command can be typed and executed.

Iii. Methods of Use
First, vim file opens a document
General mode

650) this.width=650; "title=" 1.jpg "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M00/5C/08/ Wkiom1uzeelxulbbaaj9m_ojtzm912.jpg "alt=" Wkiom1uzeelxulbbaaj9m_ojtzm912.jpg "/>

Command mode

650) this.width=650; "title=" 2.jpg "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M01/5C/08/ Wkiom1uzeeltfilsaaeyx3f8anw115.jpg "alt=" Wkiom1uzeeltfilsaaeyx3f8anw115.jpg "/>

K, J, H, l move the cursor up and down respectively, personal prefer to use the arrows up and down
w   jump to the next word, by punctuation or Word division
w   jump to the next word, long jump, If End-of-line is considered a word
e     jumps to the next end
e     jumps to the next word, long jump
b      jumps to the previous word
b     jumps to the previous word, long jump
0  jumps to the beginning of the line, whether or not indented, or jumps to the No. 0 character
*      find the word where the cursor is located, and look down to
#     the word where the cursor is located, and look up
s     Delete the current character and enter edit mode
s     Delete the line of the cursor and enter edit mode

Both Wq and X are saved and exited, and the difference between them is:
Wq
Mandatory write file and exit. Force write even if the file is not modified, and update the file's modification time.
X
Write the file and exit. The file modification time is not updated unless the file is modified and the file modification time is updated.
Iv. Other
Some commands explain:
% full text ("%" is an abbreviation for "1,$" range)
S replacement
/Search String start
/Search String End
/g the replacement string ends, and g represents the replacement of all matching results for each row.
N Find Next & (when a string is found in vim using//To find a string, press N, the cursor jumps to the next string)
Bulk Comment or uncomment text
Comment Text:
In general mode, press CTRL + V, the up and down arrows to select each row, then press the Caps I, insert the # sign, and then press ESC twice
Uncomment:
Press CTRL + V in general mode and then up and down arrows full content (select # for each line), press X to

This article from "Step by step into the Linux World" blog, reproduced please contact the author!

Talking about VIM

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.