Creating an IDE programming environment with GVIM (Windows chapter)

Source: Internet
Author: User

Transferred from: http://my.oschina.net/kontor/blog/50717

0. Prepare the software and plugins.
(a) Gvim72.exe address Ftp://ftp.vim.org/pub/vim/pc/gvim72.exe.
(b) Vimcdoc-1.7.0-setup.exe address http://prdownloads.sourceforge.net/vimcdoc/vimcdoc-1.7.0-setup.exe?download
(c) Ec57w32.zip address Http://prdownloads.sourceforge.net/ctags/ec57w32.zip
(d) Taglist_45.zip address http://www.vim.org/scripts/download_script.php?src_id=7701
(e) Winmanager.zip address http://www.vim.org/scripts/download_script.php?src_id=754
(f) Minibufexpl.vim address http://www.vim.org/scripts/download_script.php?src_id=3640
(g) A.vim address http://www.vim.org/scripts/download_script.php?src_id=7218
(h) Grep.vim address http://www.vim.org/scripts/download_script.php?src_id=7645
(i) Visualmark.vim address http://www.vim.org/scripts/download_script.php?src_id=4700

1. Install the gvim7.2.
Run Gvim72.exe, select Full installation, my installation directory is the default C:\Program files\vim.
When the installation is complete, it includes the folder Vim72 and the folder Vimfiles, as well as the script _VIMRC.

2. Install the Chinese Help manual.
Run Vimcdoc-1.7.0-setup.exe and it will automatically find the installation location of the Gvim.
The Help manual is already in Chinese when you reopen gvim,:help after the installation is complete.
At this point, my gvim menu was garbled in Chinese.
To find a solution on the Internet, delete the folder named Lang C:\Program files\vim\vim72 and turn the menu language into English.

3. Syntax highlighting.
First, edit the _VIMRC file to add the following:
Set nu!
ColorScheme Desert
Syntax enable
Syntax on
These settings enable Gvim to display line numbers, use the desert color scheme, and open the syntax highlighting feature (display comments, keywords, strings, and so on in different colors).
We can also highlight the function name, find C.vim and Cpp.vim under C:\Program files\vim\vim72\syntax, and add the following separately:
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
To reopen the Gvim, the effect is as follows:

4. Jump in the program.
Unzip the Ec57w32.zip, locate the Ctags.exe in the extracted folder, copy it to C:\ProgramFiles\Vim\vim72, and edit the _VIMRC file to add the following:
Set tags=tags;
Set Autochdir
Open the cmd command line, switch to the root of the source code you want to view, run
Ctags-r
A tags file will be generated at this directory.
Open a code file with Gvim, place the cursor over a function name, such as Updateviewbyposno (), press CTRL +], and the cursor will automatically jump to the definition.

Pressing "ctrl+t" will jump back to its original position.
variables, structs, macros, and so on, can do this.
When your source files are updated, you can only rerun the ctags-r command to update the tags file.

5. Window management.
Unzip the Taglist_45.zip, unzip it with a Doc folder and a plugin folder, and copy the contents to the doc and plugin under C:\Program files\vim\vim72, respectively.
Add the following to the _VIMRC file:
Let tlist_show_one_file=1
Let Tlist_exit_onlywindow=1
Open the code file with Gvim (the tags file has been generated): The Tlist,taglist window appears on the left.
Unzip and copy the Winmanager.zip in the same way, adding the following to the _VIMRC file:
Let g:winmanagerwindowlayout= ' fileexplorer| TagList '
Nmap wm:wmtoggle<cr>
Open the code file with Gvim, enter the command "WM" in normal state, the window is as follows

Where the top left is the NETRW window (browse for the file), the bottom left is the TagList window, and when you enter "WM" again, these two windows will be closed.

6. Multi-file editing.
Copy Minibufexpl.vim to C:\Program Files\vim\vim72\plugin and add it in _VIMRC:
Let G:minibufexplmapctabswitchbufs=1
Let G:minibufexplmapwindowsnavvim=1
Let G:minibufexplmapwindownavarrows=1
When you open two or more than two files with Gvim, the Minibufexplorer window pops up automatically, such as

Ctrl+tab, switch to the previous buffer and open the file in the current window;
Ctrl+shift+tab, switch to the latter buffer and open the file in the current window;
CTRL + ARROW keys, you can switch to the upper and lower left and right window;
ctrl+h,j,k,l, switch to the upper or lower window.


7. Quickly switch the header file/source file.
Copy A.vim to C:\Program Files\vim\vim72\plugin and add it in _VIMRC:
Nnoremap <silent> <F12>:a<cr>
After opening the source file with Gvim, press F12 to switch in the c/h file, or you can enter: A to achieve.

8. Quickly find in the project.
Copy Grep.vim to C:\Program Files\vim\vim72\plugin and add it in _VIMRC:
Nnoremap <silent> <F3>:grep<cr>
Open the source file with Gvim and position the cursor on the content you want to find, press F3 to determine what to look for and search for, Gvim will list all eligible search results in the pop-up Quickfix window. Such as

Supports regular expressions when determining what to look for.

9. Highlight the bookmark.
Copy the Visualmark.vim to the C:\Program files\vim\vim72\plugin.
Open the source file with Gvim, position the cursor where you want to add a bookmark, press CTRL+F2, or add a bookmark.

Use F2 to toggle between bookmarks, shift+f2 reverse.

Creating an IDE programming environment with GVIM (Windows chapter)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.