0. Prepare software and plug-ins.
(Aw.gvim72.exe address ftp://ftp.vim.org/pub/vim/pc/gvim72.exe.
(Bw.vimcdoc-1.7.0-setup.exe address http://prdownloads.sourceforge.net/vimcdoc/vimcdoc-1.7.0-setup.exe? Download
(Cw.ec57w32.zip address http://prdownloads.sourceforge.net/ctags/ec57w32.zip
(D1_taglist_45.zip address http://www.vim.org/scripts/download_script.php? Src_id = 1, 7701
(E)winmanager.zip address http://www.vim.org/scripts/download_script.php? Src_id = 1, 754
(F) minibufexpl. Vim address http://www.vim.org/scripts/download_script.php? Src_id = 1, 3640
(G) A. Vim address http://www.vim.org/scripts/download_script.php? Src_id = 1, 7218
(H) grep. Vim address http://www.vim.org/scripts/download_script.php? Src_id = 1, 7645
(I) visualmark. Vim address http://www.vim.org/scripts/download_script.php? Src_id = 1, 4700
1. Install gvim7.2.
Run gvim72.exe and select full. The default installation directory is c: \ Program.
Files \ vim.
After the installation is complete, the vim72 folder, vimfiles folder, and script _ vimrc are included.
2. Install the Chinese help manual.
Run vimcdoc-1.7.0-setup.exe. It will automatically find the installation location of gvim.
After installation, re-open gvim. The help manual is already in Chinese.
At this step, garbled Chinese characters appear in the gvim menu.
Find a solution on the Internet and delete the Lang folder under C: \ Program Files \ Vim \ vim72 to change the menu language to English.
3. syntax highlighting.
First, add the following content to the edit _ vimrc file:
Set Nu!
Colorscheme desert
Syntax enable
Syntax on
These settings enable gvim to display the row number, use the desert color scheme, and enable the syntax highlighting function (display comments, keywords, strings, etc. with different colors ).
We can also highlight the function name, find C. vim and CPP. Vim in c: \ Program Files \ Vim \ vim72 \ syntax, and add the following content respectively:
SYN match cfunction "\ <[A-Za-Z _] [a-zA-Z_0-9] * \> [^ ()] *) (" Me = E-2
SYN match cfunction "\ <[A-Za-Z _] [a-zA-Z_0-9] * \> \ s * (" Me = E-1
Hi cfunction GUI = none guifg = # b5a1ff
Open gvim again. The effect is as follows:
4. Jump in the program.
Copy ec57w32.zip to ctags.exe in the folder after decompression, copy it to c: \ ProgramFiles \ Vim \ vim72, edit the _ vimrc file, and add the following content:
Set tags = tags;
Set autochdir
Open the CMD command line, switch to the root directory of the source code you want to view, and run
Ctags-R
A tags file is generated in this directory.
Open a code file with gvim, place the cursor on a function name, such as updateviewbyposno (), and press "Ctrl +]". The cursor will automatically jump to the definition.
Press Ctrl + T to jump back to the original position.
Variables, struct, macros, and so on.
When your source file is updated, you can only run the ctags-R command again to update the tags file.
5. Window Management.
Decompress the taglist_45.zip file, decompress it, and include a doc folder and a plugin folder. Copy the content to c: \ Program respectively.
Files \ Vim \ vim72 In the doc and plugin.
Add the following content to the _ vimrc file:
Let tlist_show_onE_file = 1
Let tlist_exit_onLywindow = 1
Use gvim to open the code file (the tags file has been generated). The: tlist and taglist windows appear on the left.
Decompress and copy winmanager.zip in the same region, and add the following content to the _ vimrc file:
Let G: winmanagerwindowlayout = 'fileexplorer | taglist'
Nmap wm: wmtoggle <CR>
Open the code file with gvim and enter the "Wm" command in normal state. The window is as follows:
The top left is the netrw window (Browse File), and the bottom left is the taglist window. When you enter "Wm" again, the two windows will be closed.
6. edit multiple files.
Copy minibufexpl. Vim to c: \ Program
Files \ Vim \ vim72 \ plugin, add in _ vimrc:
Let G: minibufexplmapctabswitchbufs = 1
Let G: minibufexplmapwindowsnavvim = 1
Let G: minibufexplmapwindownavarrows = 1
When you use gvim to open two or more files, the minibufexplorer window is automatically displayed, as shown in figure
CTRL + TAB, switch to the previous buffer, and open the file in the current window;
CTRL + Shift + TAB, switch to the next buffer, and open the file in the current window;
CTRL + Arrow, you can switch to the upper, lower, and left windows;
CTRL + H, J, K, L, switch to the upper and lower left windows.
7. quickly switch the header file/source file.
Copy A. Vim to c: \ Program Files \ Vim \ vim72 \ plugin and add:
Nnoremap <silent> <F12>: A <CR>
After opening the source code file with gvim, press F12 to switch between C and H files, or input.
8. Quick search in the project.
Copy grep. Vim to c: \ Program
Files \ Vim \ vim72 \ plugin, add in _ vimrc:
Nnoremap <silent> <F3>: grep <CR>
Open the source code file with gvim, move the cursor to the content to be searched, and press F3 to determine the content to be searched and the search range, gvim will list all matching search results in the pop-up quickfix window. For example
Regular Expressions are supported when determining the content to be searched.
9. Highlighted bookmarks.
Copy visualmark. Vim to c: \ Program
Files \ Vim \ vim72 \ plugin.
Open the source code file with gvim, move the cursor to the place where you want to add bookmarks, and press Ctrl + F2 to add bookmarks.
Use F2 for forward switching between bookmarks, Shift + F2 for reverse switching.