Source: http://luckybins.blog.51cto.com/786164/681325
========================================================== ====================
Gvim enables users to edit texts like Linux Vim tools in windows, especially programming. Many plug-ins are available. However, after all, the Windows environment is different from the Linux environment, and many plug-ins are difficult to install.
(1) CTAG and taglist
These two tools provide a list of functions on the left, similar to Visual Studio. In addition, the installation is very simple. The steps are from http://www.cnblogs.com/zourrou/archive/2011/04/05/2005517.html. In my use, the configuration is slightly changed.
1. Download ctags and set the ctags.exe
Copy to the directory where gvim.exe is located. My directory is c: \ Program Files \ Vim \ vim73. If it is not copied, "taglist: exuberant ctags (http://ctags.sf.net) not found in path will appear. plugin is not loaded. "(you can do this without copying it. You need to add it to the environment variable ). 2. Download The taglist.zip file, decompress it, and copy the doc \ taglist.txt file to c: \ Program Files \ Vim \ vimfiles \ doc to plugin \ taglist. copy the vim file to c: \ Program Files \ Vim \ vimfiles \ plugin 3. Under cmd, go to the cd c: \ Program Files \ Vim \ vimfiles \ doc directory, run gvim.exe, and enter ": helptags. ", restart gvim.exe. At this step, you have installed the taglist. 4, open any code file, input ": tlist", you can open/close the taglist ctags download http://sourceforge.net/projects/ctags/files/ctags/5.8/ctags58.zip/download taglist download http://www.vim.org/scripts/script.php? Script_id = 273 (2) cscope this tool allows us to query a function or variable declaration and definition, and how many references there are. The installation process is complicated! Since the official version is the source code package, we need to compile it on our own, and compile and configure a very complex environment. Step 1: Install mingw. Download it from SourceForge. It is worth noting that downloading SourceForge in China is very slow. Here we find a good image site, with a much better network speed than the original site, and the resources are organized according to the index, very easy to find. Find the mingw project. The Installation File is automatically downloaded from SourceForge for resources. A slightly larger file will fail. In this case, you need to manually download the file. You can search for it on the Image site based on the file name combined with the resource organization method. For example, gcc-3.4.4-3-msys-1.0.13-bin.tar. lzma, find it in the msys/GCC directory. After the download is complete, modify the file name correctly (with the suffix lzma ). After the installation is complete, you need to add mingw/bin and mingw/sys/1.0/bin and mingw/sys/1.0/local/bin to the environment variable for convenience. Step 2: Install the tool set getgnuwin32. You just need to go to the SourceForge image site to find it. It's a few megabytes long and it's better to install it. Step 3: In addition, several components are required to compile the scope. 1. RegEx library. You can download a separate RegEx from SourceForge or from the mingw project. I use the latter method. Download mingw-libgnurx-2.5.1-dev.tar.gz in the project directory, put RegEx. h In include into the include directory of mingw, And put libgnurx. dll. A and libregex. La in lib into the lib directory of mingw. Download mingw-libgnurx-2.5.1-bin.tar.gz and put the libgnurx-0.dll in the directory where the program is located. (Transferred from: http://blog.creke.net/766.html ). If it is not installed, the header file of RegEx. h cannot be found in configure. 2. pdcurses tool. Or download it from SourceForge or mingw. (You can download the. exe file, but after installation, several files are generated. You still need to perform the following steps .) Unzip the package and perform the following three steps (from the http://comptb.cects.com/1848-adding-pdcurses-to-mingw ):
- Pdcurses. lib to mingw's "/lib" folder
- Cursors. h and panels. h to mingw's "/include" folder
- Pdcures. DLL to mingw's "/bin" folder
3. PCRE tool. Download pcre-x86-mingw4-8.12-src.tar from the sourceforgeimage site (search is required, not in the mingw project ). This tool is troublesome and needs to be compiled by ourselves. Because mingw has been installed before, you can directly run the sh command to enter the shell, decompress ,. /configure make install method for compilation and installation. The installation file is in the mingw/sys/1.0 folder. In this case, copy the. Lib. H. dll file to the corresponding mingw folder like installing the pdcurses tool. Step 4: Compile and install the scope. After so many preparations, we can finally start the installation. The installation method is from http://blog.csdn.net/mslk/article/details/1598513. This document describes the installation method of version 15.6. Although the latest version of SourceForge is 16.7a, an error is always reported during the compilation of the new version (the variables referred to by a macro cannot be identified ), the old version is still used for installation. After the installation is complete, you still need to add it to the environment variable! In addition, you also need to add the environment variable tmpdir for scope, such as set
Tmpdir = C:/temp, once and for all, add it to the system variable! (From http://blog.csdn.net/cohowang/article/details/4393258) modify source code
In the CMD window, enter the cscope-15.6 directory and execute: 1. Sh configure-build = mingw32. wait a few minutes. At last you can see the information: config. Status: Creating src/makefile.
1. Go to the src directory 2. Open and edit global. H. At the end of the file # endif
/* Before cscope_global_h */, add two lines: # DEFINE _ djgpp __# DEFINE _ msdos__3, open and edit exec. C, comment out 41 lines: // # include
<Sys/Wait. H> 4. Open and edit mypopen. C, comment out 37 rows: // # include
<Sys/Wait. H> comment out 84 and 85 rows: // If (FD! =-1 & (fcntl (FD, f_setfd, close_on_exec )! =-1) // return (FD); 5. Open and edit find. C. Comment out row 1160: // (void)
Sleep (3); 6. Open and edit main. c. Modify 360 rows orig_umask = umask (s_irwxg | s_irwxo); orig_umask = umask (s_irwxu); Modify 363 rows if (mkdir (tempdirpv, s_irwxu) {: if (mkdir (tempdirpv) {comment out 378 rows: // signal (sigquit, myexit); comment out 381 rows: // signal (sighup, myexit ); comment out 404 rows: // signal (sigpipe, sig_ign);/* | command can cause pipe signal */modify 895 rows if (Sig = sigquit: if (Sig = sigterm | Sig = SIGABRT | Sig = sigbreak) {modify 175 rows of fprintf (stderr ," % S: Version % d % s/n ", argv0, fprintf (stderr," % s: Version % d % S. /tcompiled by mslk/N ", argv0, 7. Open and edit makefile, and modify 133 rows of curses_libs =-lcurses to: curses_libs =-lpdcurses-lpcre 3. Compile csses, in the CMD window, enter the directory of the cscope-15.6/src and execute: Make-kcs1_- V and look at the latest version compiled by yourself.
(3) omnicppcomplete. Vim
The most troublesome thing has passed, and the other two are very easy to install. This tool provides auto-completion functions similar to Visual Studio. Install the plug-in under vimfile according to the instructions. Specific Method:
after\ftplugin\cpp.vim after\ftplugin\c.vim autoload\omni\common\debug.vim \utils.vim autoload\omni\cpp\complete.vim \includes.vim \items.vim \maycomplete.vim \namespaces.vim \settings.vim \tokenizer.vim \utils.vim doc\omnicppcomplete.txt
(4) A. Vim
This is the easiest way to install, because there is only one file that can be copied to the plugin directory. This tool provides fast. cpp and corresponding. h file switching. You can directly: A, open the file. cpp and. h corresponding to: Av, open the file. cpp and. h corresponding to, and split the screen.
(5) Compile the vimrc configuration file
This requires technology! However, we only need to use gvim to write the configuration on the Internet. The script provided by VIM's program world is quite good! Copy ~
Http://www.vimer.cn /? P = 91 http://www.vimer.cn /? P = 114 http://www.vimer.cn /? P = 150
(6) Note
Here, a powerful gvim configuration is complete. I thought it was quite easy to use. The result was just like this. Haha, let it go. It took a day to get the result. The source code to be parsed cannot contain Chinese file names and Chinese paths. Be sure to pay attention to it! In addition, use the scope command to add the parsed file every time!
(7) Conclusion
The installation has come to an end, and we need to use these tools well to make the best of its role. I had a hard time installing the package for one day. I had to pay for several pieces of traffic and the project had to be postponed. Alas ~ How can I deal with the two bosses ~~~~~ O (>_<) O ~~