Vim tab Turn four spaces
Vim/etc/vim/vimrc
Set et sta sw=4 sts=4
For a saved file, you can use the following method to replace the Space and tab:
tab is replaced with a space:
: Set ts=4
: Set Expandtab
:%retab!
Space is replaced with tab:
: Set ts=4
: Set Noexpandtab
:%retab!
Add! is the tab that is used to process non-whitespace characters, that is, all tabs, if not added, only the tab at the beginning of the line is processed
To open multiple files:
Ctrl+p lists multiple files and automatically complements them in a way that
Ctrl+6 switching between two files
, b top dropdown list file-next page, prev, CTRL + N, ctrl+p
How to switch between panes
To open multiple windows:
: SP//Split Horizontal window
: Vsplit//Vertical Slicing window
ctrl+w+ arrow key--Switch to front/bottom/up/back one pane
ctrl+w+h/j/k/l--Ibid.
ctrl+ww--switch back to the next pane in turn
Screen cursor Position
Top of Shift+h
Shift+m Middle
Shift+l Bottom
5. Search and locate:
Shift+f before the search
FF Post-Search
GD find the variable and the definition of the method where the cursor is located (local variable)
Select, copy, or find the word where the cursor is located
In vim, use IW or AW to represent a word, which is slightly different, and a indicates the spaces that are included before the word:
Select the word where the cursor is located: Viw (v enters visual mode, then IW)
The word where the cursor is copied: Y (a) W () indicates or
Delete the word that is located in the cursor: D (a) W
Find the word where the cursor is located: * Look down, #往上查找
Word movement:
W W move to the beginning of the next word
E e moves to the end of the next word
b b backwards to the beginning of the previous word
It is important to note that E ignores punctuation, such as: I ' m,e will be two words, E won't
Similarly, precede the command with a number that represents the number of executions, such as: 2w, to move 2 words down
?
shift+= move to the beginning of the next line
Note differs from above-moves to the beginning of the previous line
Page
Ctrl+u,d up and down half a page
Ctrl+f,b up and down one page
Code Folding
Write a function, select it in Visual mode, and then ZF creates the folder. This will allow you to collapse the display. You can also create a second-level collapse.
ZR, open all first-level folds.
ZM, close all folds.
ZC, close the current fold.
Zo, opening the current fold
Other:
CTRL + V column mode
V-line Mode
CTRL + N code hint completion function
The key to merge two rows with two lines is J
A practical way to use vim