One, Text editor : Vi,vim
Ascii:
UTF:
File Editor Categories:
Full Screen Text editor:
Nano
Vi,vim
Emacs
Text Editor:
Sed
VI--->VIM
Patterned editors: A variety of different modes
Edit mode: Command mode
Input mode: Insert mode
Last-line mode: Vim has many built-in commands, and this mode is the interface for its commands
1. Open File
Vim [OPTIONS] [FILE] ...
2. Conversion between modes :
The default is edit mode---> Input mode:
I:insert, at the current cursor, converted to input mode
I: Convert to input mode at the beginning of the line where the cursor is currently located
A:append, converted to input mode after the current cursor character
A: Convert to input mode at the end of the line at which the cursor is currently located
O: Create a new blank line below the current cursor line and convert to input mode
O: Create a new blank line above the line at the current cursor and convert to input mode
Input mode---> Edit mode: Press the ESC key
Edit Mode---> Last-line mode::
Last-line mode---> Edit mode: Press the ESC key
3. Exit Vim
Last-line mode:
Q! Force quit, do not save edited content to exit directly
Wq Save exit
X Save exit
wq!,x! Force Save exit
Edit mode:
ZZ: Save exit
4. Edit command
①, cursor movement:
Move between characters: H,j,k,l left, bottom, top, right #[h,j,k,l]: Move N-character spacing at a time
Move between words: W The first word of the next word
E The ending of the current or next word
b The first word of the current or previous word #[w,e,b]
Jump at the end of the beginning line:
0: Jump to the absolute beginning
^: first non-whitespace character at the beginning of a line
$: Jump to absolute end of line
Quick jump between lines: #G # # line last line mode: # jump to # # line
G text Tail
GG First
②, edit operation:
X: Delete the character of the cursor #x: Delete the cursor and the back of the male # characters
D: Delete command
DD: Delete cursor line is equivalent to D
#dd: Delete the line with the cursor and the next total # line
Use with the jump command:
d$: Delete the contents of the cursor at the end of the line
d0,d^
Dw,db,de
P: Paste,
Line level:
P: Paste below the line where the cursor is located
P: Paste above the line of the cursor
Less than line level:
P: Paste at the rear of the cursor
P: Paste in front of cursor
Y: Copy command
YY: Delete cursor line equals y
#yy: Delete the line with the cursor and the next total # line
Use with the jump command:
y$: Delete the contents of the cursor at the end of the line
y0,y^
Yw,yb,ye
C: Modify
Enter input mode after deletion
U: Undo #u undo the last # operation at one time
Ctrl+r Revocation of previous revocation
. Repeat the previous command
R: Replace command
Vimtutor???
Report:
Vimtutor Chinese Version
5, can be tested mode
V: Select the contents of the cursor to the left of the cursor line
V: The line where the cursor is located is selected
6. Flip Screen command in edit mode
CTRL+F: Flip a screen to the end of the file
CTRL+B: Flip a screen to the file header
Ctrl+d: Turn half screen at the end of the file
Ctrl+u: Turn half screen to file header
7. Text lookup supports regular expressions
/pattern
? PATTERN
8. Text substitution
Last-line mode:
There are some built-in commands for editing operations, which can be done using the address-bound method
Address delimitation: Startline[,endline]
#: Line #
.: When moving forward
$: Last line
%: Full text
Relative delimitation:
+#: Down # lines from a specified position 10,+5
-#: # lines up from a specified position 10,-5
Text substitution: s
s/what to look for/replace with content/modifiers
/: Delimiter, used to split "what to find" and "Replace with" this delimiter can use other symbols such as: @,#.
You can use regular expressions to find what you want, and you can use the "&" reference in the "Replace with Content" section later
Replace with the content, not using regular expressions, generally normal text but you can use \1,\2 in regular expressions ... saved content
Modifier:
I: Case insensitive when looking for characters
G: Global Substitution
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/71/F0/wKioL1XbOFHQHGiNAAFutikKSwI798.jpg "title=" Smy%pz _x1q_zi3t8$luyn~n.png "alt=" Wkiol1xbofhqhginaafutikkswi798.jpg "/>
9. Multi-file Mode
Open File: Vim [OptIn] ... [FILE] ...
+#: Quick positioning to # line
+/pattern: Quickly navigate to the row that was first matched by the pattern
Multiple files:
Last-line mode:
Next,prev,first,last
Save and exit All files:
Wqall,,wall,qall
Multiple windows:
-o: Horizontal split window
-O: Vertical Split window
Ctrl+w,arrow
Note: Individual files can also be split into multiple windows for viewing
Ctrl+w,s Horizontal Split
Ctrl+w,v Vertical Segmentation
10. Interface Display Features
Last-line mode:
Show line number:
Set Number,set nu
Set Nonumber,set Nonu
Syntax highlighting:
Syntax on
Syntax off
Search highlighting
Set Hlsearch
Set Nohlsearch
Auto indent: Not turned on by default
Set Autoindent,set AI
Set Noauntoindent,set Noai
Distinguishing character case from opening and closing
Set Ignorecase,set IC
Set Noignorecase,set Noic
Highlight matching symbol pairs: default on
Set Showmatch,set SM
Set Noshowmatch,set NOSM
11. Vim Configuration file
Global:/ETC/VIMRC
Personal: ~/.VIMRC
The VIM editor uses