My VIM configuration:
Set number//Display line numbers set showmatch// auto associative parentheses set tabstop=4 //Set tab length set Autoindent //Auto Indent set Foldmethod=indent //Folding filetype on// automatic file format recognition
Common commands:
< basic editing Operations >
Move up and down: corresponding to the upper (K), the lower (J), left (H), right (L); This is the basic requirements, do not use the arrow keys, with the direction of the key friends can't hurt ~.
GG: Jumping to the beginning of a document
G: Jump to the end of the document
W: Jumps to the beginning of the next word; 4w: Jump to the beginning of the fourth word, and so on.
E: Jumps to the end of the next word
B: Jump to the beginning of the previous word, 4b: Jump to the beginning of the fourth word, and so on.
0: Jump to the beginning of a line
^: jumps to the first character at the beginning of a line
$: Jumps to the end of a line
< copy and paste >
Y means copy, d means delete, p means paste. Where copy and delete are with the cursor move command
YY: Copy Entire row
DD: Delete entire row
DDP: Swapping the current line and the next line
Ggyg: means copying entire document
GGDG: Delete entire document
YW: Represents the copy from the current cursor to the end of the word where the cursor is located.
DW: Represents the deletion of content from the current cursor to the end of the word at the cursor.
Y0: Represents the contents of a copy from the current cursor to the beginning of the cursor.
D0: Represents the deletion of content from the current cursor to the beginning of the cursor.
Y$: Represents the copy from the current cursor to the end of the line at which the cursor is located.
d$: Indicates the deletion of the content from the current cursor to the end of the line at which the cursor is located.
YfA: Represents the contents of the copy from the current cursor to the first a character following the cursor.
DFA: Represents the deletion of the contents from the current cursor to the first a character following the cursor.
Common plug-ins: 1, TagList
Used to display a list of functions
Installation:
1) Download taglist;
2) Unzip Taglist.zip
3) Copy the doc and plugin folder contents to the. Vim/doc and. Vim/plugin directories (if there is no. Vim in the user directory, manually create a mkdir. Vim)
3) enter the. Vim/doc directory, run vim, enter command: helptags. command. This step is to add the Help document under Doc to the VIM Help topic so that we can view the TagList Help by running the Taglist.txt in Vim
4) Vim opens the document by command: Tlisttoggle can open all functions list
The following is a personalized configuration tlist:
CD to/etc/vim, under Modify VIMRC file, note that the directory requires system permissions, and therefore requires sudo vim VIMRC
Let tlist_show_one_flie=1 // <span><span> does not display multiple file tags at the same time, only shows the current file's </span></span> Let tlist_file_fold_auto_close=1 //Browse for a function, other functions default collapse let tlist_exit_onlywindow=1 //<span> <span> If the TagList window is the last window, exit vim</span></span> let tlist_auto_open=1 //Open VIM Tlisttoggle is turned on by default
2, Nerdtree
Used to display the document structure
Installation:
1) Download Nerdtree
2) Same decompression copy
3) Vim open Document by command: Nerdtree open Document structure maker
3, Ctags
for function jumps
Installation:
1) Download Ctags compression pack
2) Unzip the tar xvf filename.tar.gz
3) post-compilation installation
./configure
Make
sudo make install
Use:
Go to project directory
1) Enter command: Ctags-r, after the execution of this command, you will find that in the project folder more than one tags file
2) Configure VIMRC to include the following in this file:
Set tags=tags; Set Autochdir
PS: Semicolon not less, each time with a project, configure once
If you find a variable or function, CTRL +], you can follow it down and follow it backwards by ctrl+t the assembly.
Solve Chinese garbled characters
Edit VIMRC File:
Set Fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936set Termencoding=utf-8set encoding=utf-8
Vim Usage Summary