At the time of HS, I saw the technical master xcmg use Vim to build the project, while others use Si or slickedit. At that time, I really liked him. After a day of exploration, you can also use gvim to build an IDE environment. It is also necessary to build a project.
To collect resources from the Internet, I will refer to the article "How to manually convert Vim into an IDE programming environment. Now, let's get down to the truth.
1. Prepare necessary plug-ins.
Gvim installer http://www.vim.org/download.php#pc
Help document Chinese Version
Http://sourceforge.net/projects/vimcdoc/files/latest/download? Source = files
Ctags58.zip http://sourceforge.net/projects/ctags/files/
The taglist http://www.vim.org/scripts/download_script.php? Src_id = 1, 7701
Winmanager
Http://www.vim.org/scripts/download_script.php? Src_id = 1, 754
Minibufexpl. Vim
Http://www.vim.org/scripts/download_script.php? Src_id = 1, 3640
A. Vim
Http://www.vim.org/scripts/download_script.php? Src_id = 1, 7218
Grep. Vim
Http://www.vim.org/scripts/download_script.php? Src_id = 1, 7645
Visualmark. Vim
Http://www.vim.org/scripts/download_script.php? Src_id = 1, 4700
2. Install software
Install gvim, so you don't have to go into details. Monkey will.
And then set the environment variables. For example, if I install the environment variables in F: \ gvim INSTALL \ vim, add vim_home to the environment variables> system variables. The value is F: \ gvim INSTALL \ vim; add F: \ gvim INSTALL \ Vim \ vim73 to path
3. basic configuration
4. install necessary plug-ins
Install Chinese help manual
Vimcdoc-1.8.0-setup-unicode.exe, maybe not of this style. After running, it will automatically find the installation directory of gvim. Run gvim again and enter the command: Help. The help is already in Chinese.
Program jump
You can view functions, variables, and other definitions. This is a little difficult during installation, and it is unclear whether to run the ctags command in gvim or cmd. Finally, I figured it out. This is the case. First, install the tool without installation. decompress the tool and place it in a directory. Then, add the environment variable. For example, I decompress it in F: \ gvim INSTALL \ ctags58, and then add F: \ gvim INSTALL \ ctags58 in path.
After all these operations are completed, input the ctags In the CMD of the window. We can see that the system recognizes the ctags command.
Edit the _ vimrc file and add the following content:
Set tags = tags; // note the semicolon
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 will be 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.
Window Management
Decompress the taglist_45.zip file, decompress it, and include the doc and plugin folders. Copy the contents to the doc and plugin of $ Vim \ vim73.
In the _ vimrc file, add
Let tlist_show_one_file = 1
Let tlist_exit_onlywindow = 1
Open the code file with gvim and enter tlist. The tlist window appears on the left.
Decompress and copy winmanager.zip using the same token, and add the following content to the _ vimrc file,
Let G: winmanagerwindowlayout = 'fileexplorer | taglist'
Nmap wm: wmtoggle <CR>
Open the Code with gvim and enter the command "Wm" in normal state. Note that there is no colon Before the command. The netrw window and taglist window of the Project will appear on the left, when you enter WM again, these two windows will be closed.
Multi-file editing
Copy minibufexpl. Vim to $ Vim \ vim73 \ plugin, and add:
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.
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.
Quick Switch of header files/source files
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.
Quick Search in projects
Copy grep. Vim to c: \ Program Files \ Vim \ vim72 \ plugin and add:
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.
Regular Expressions are supported when determining the content to be searched.
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.