Vim is a text editing tool under the Linux operating system, which is very powerful, but it is more complex to learn. All of Vim's functions have to be understood to be hundreds of pages, and here are just a few of the basic uses of VIM.
First VIM opens the file in three ways:
Vim +# xxx (#is a number): means to open the xxx file and position the cursor to the specified line.
Vim-o xx1 xx2 xx3: Open three files simultaneously, vertical split display
Vim-o xx1 xx2 xx3: Three files open at the same time, horizontal split display
Multiple inter-file jumps: after typing ctrl+w: → left, ← Right, ↑ up, ↓ down
Vim opens a file and is divided into three modes: edit mode, input mode, and last line mode. Edit mode and input mode can be transferred to each other, edit mode and the last row mode can be mutually, the input mode and the last line mode is not interactive.
Here's a look at the common usage of each pattern:
The default mode after opening the file, in which the keystrokes on the keyboard indicate the editing of the text, the control of the cursor
-
-
Editing of text : Copy, paste, delete, modify, replace, Undo, redo, similar to the function of the Edit menu in the text Editing tool under the graphical interface.
copy : y+ (Y, L, W, (,), {,}) represent duplicates (current line, character, word, previous sentence, next sentence, previous paragraph, next paragraph)
paste: P Paste to the next line of the cursor or the following character, p pasted to the cursor line or the previous character
Delete : d+ (D, L, W, (,), {,}) respectively for deletion (current line, character, word, previous sentence, next sentence, previous paragraph, next paragraph)
Change : c+ (C, L, W, (,), {,}) indicate changes (current line, character, word, previous sentence, next sentence, previous paragraph, next paragraph)
Here is a diagram to see more clearly:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/28/D9/wKioL1N7c7-gjXzXAAB1Q8ihNqU851.png "title=" capture. PNG "style=" white-space:normal; "alt=" Wkiol1n7c7-gjxzxaab1q8ihnqu851.png "/>
x Delete cursor after one character, x delete cursor before one character
#x Delete the cursor as a dry character, #X delete several characters before the cursor (# indicates a number)
R replaces the character where the cursor is located, R replaces the character around the cursor
U undo operation, Ctrl+r recovery undo
-
-
control of the cursor :
Inter-character Jump: H-Jump, J-Jump, K-Jump, L-right jump (for easy memory J, K also recorded in the word putting)
Jump between words: W next word First, E next word ending, b current word or first word
Jump between sentences:) Next sentence, (previous sentence
Interbank Jump: #G line (# indicates number)
In-line jump: h left jump, #j jump, k jump, #l right jump (represents numbers. For ease of memory #j, #kalso in the line)
, ^ line non-null characters, 0 absolute beginning, $ footer
Jump between paragraphs: {Previous paragraph,}
Inter-screen jump: ctrl+b on a screen, ctrl+f next screen, Ctrl+u upper half screen, ctrl+d lower half screen
In-file jump: 1G or GG turn first, m turn middle, g turn tail
Inter-file jump (if Vim-o or vim-o open multiple files on the same screen): Ctrl+w after: → left, ← Right, ↑ up, ↓ down
Exit after saving: ZZ
Typing the corresponding text character by tapping the key on the keyboard in this mode
In edit mode by typing I, I, A, A, O, o into input mode, and then typing the ESC key to exit the input into edit mode.
I insert before cursor
I inserted at the beginning of the cursor
A after the cursor is inserted
A cursor at the end of the line input
o New line below cursor and accept input
o New line above cursor and accept input
In edit mode, enter colon into the last line mode, type:
W Save
Q exit
! mandatory
wq! force Save after exiting
X Save exit
Qall to exit all open files
First to skip to file one
Next to the next file
Last to final file
Prev to previous file
Set Nu setting Displays line numbers
Set Nonu suppress line numbers
Help View assistance (type ESC, colon, q exit Help)
/xxx down find xxx,n next match, N previous match
? xxx look up xxx,n next match, N previous match
Two ESC keys exit last line mode return to edit mode
This article is from the "Li Mu bai" blog, please be sure to keep this source http://limubai2014.blog.51cto.com/1709797/1414416