Environment: WINDOWS7 Flagship edition
1, installation Gvim7.4 : http://www.vim.org/download.php#pc.
2, install Chinese help : Vimcdoc-1.8.0-setup.exe address http://vimcdoc.sourceforge.net/
will automatically identify the Gvim installation path,
After installation, the Gvim menu in Chinese garbled, added in the _vimrcset file:
"Configure multi-lingual environment to solve Chinese garbled problem
If has ("Multi_byte")
"UTF-8 Code
Set Encoding=utf-8
Set Termencoding=utf-8
Set formatoptions+=mm
Set FENCS=UTF-8,GBK
If V:lang =~? ' ^/(zh/)/|/(ja/)/|/(ko/) '
Set ambiwidth=double
endif
If has ("Win32")
SOURCE $VIMRUNTIME/delmenu.vim
SOURCE $VIMRUNTIME/menu.vim
Language Messages Zh_cn.utf-8
endif
Else
Echoerr "Sorry, this version of (g) Vim is not compiled with +multi_byte"
endif
Input: Help, display the Chinese helper, indicating the installation success:
3. set Syntax highlighting
Edit the _VIMRC file in the installation directory (for example: my D:\Program Files\vim)
Add the following content:
Set nu!
ColorScheme Desert
Syntax enable
Syntax on
Open Gvim again to open a source code file:
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.
The code for C, C + + is configured here: C.vim and Cpp.vim are found under D:\Program files\vim\vim73\syntax, respectively, with the following additions:
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, the program jumps
Unzip the Ec57w32.zip, copy the Ctags.exe in the folder to D:\ProgramFiles\Vim\vim73 after decompression, and edit the _VIMRC file to add the following content:
Set tags=tags;
Set Autochdir
The D:\ProgramFiles\Vim\vim73 is then added to the path of the environment variable. Execute the command ctags-r under the source code directory you want to view, and then open the source file with Gvim:
Press and hold "CTRL" key, click the corresponding function name or "CTRL +]", will automatically jump to the definition part of the function, "ctrl+t" is returned;
5. Source Code Analysis Tool TagList
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 D:\Program files\vim\vim73, 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), enter: Tlist,taglist window appears on the left. Re-enter:
: Tlist, left column disappears; the left column lists all the macros in the current file, global variables, function names, and so on, in the view of the Code with this window to the global, switch position is very convenient
6. File Browsing Component Winmanager
Winmanager.zip Address http://www.vim.org/scripts/download_script.php?src_id=754
Unzip and copy the Winmanager.zip, unzip it with a Doc folder and a plugin folder, and copy the contents to the doc and plugin under D:\Program files\vim\vim73 respectively.
Add 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:
The upper left corner is the window to browse the file, the bottom left corner is the TagList window;
7. Multi-document editing
Minibufexpl.vim Address http://www.vim.org/scripts/download_script.php?src_id=3640
After decompression, copy the Minibufexpl.vim to D:\Program Files\vim\vim73\plugin and add it to the _VIMRC:
Let G:minibufexplmapctabswitchbufs=1
Let G:minibufexplmapwindowsnavvim=1
Let G:minibufexplmapwindownavarrows=1
After opening multiple source code files with Gvim,
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.
8, in the project quickly find
Grep.vim Address http://www.vim.org/scripts/download_script.php?src_id=7645
After decompression, copy the Grep.vim file to the D:\Program Files\vim\vim73\plugin and add it to the _VIMRC:
Nnoremap <silent> <F3>:grep<cr>
Because Windows is not with grep, you need to download grep for Windows http://gnuwin32.sourceforge.net/packages/grep.htm
Add the path of grep to the environment variable after downloading;
Open a source code file with Gvim, select what you want to find, press F3, determine what to look for and search for, Gvim list all eligible search results in the pop-up Quickfix window
9, h\c switch (for C, C + +)
Download plugin: A.vim address http://www.vim.org/scripts/download_script.php?src_id=7218
Copy A.vim to D:\Program Files\vim\vim73\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.
10. Highlight Bookmark
Download plugin: Visualmark.vim address http://www.vim.org/scripts/download_script.php?src_id=4700
Copy the Visualmark.vim to the D:\Program files\vim\vim73\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.
11. Python Code completion
Download Plugin Pydiction-1.2.zip
After extracting, copy the Python_pydiction.vim file inside to D:\Program Files\vim\vimfiles\ftplugin
Copy complete-dict and pydiction.py to D:\Program files\vim\vimfiles\ftplugin\pydiction
In the _VIMRC file, add the following configuration:
FileType plugin on "Enable filetype plug-in
Let g:pydiction_location = ' D:\Program files\vim\vimfiles\ftplugin\pydiction\complete-dict '
Let G:pydiction_menu_height = 20 "Sets the height of the popup menu, the default is 15
Open a py file with Gvim, enter Row+[tab], you can see the automatic completion of the code options
12. Python compilation
Download vimpdb, unzip and copy Vimpdb.py,vimpdb.vim to plugin.
Use Vim to open the Python code file, press F5 to run, and then press F2 to set breakpoints, after running to the breakpoint you can press F12 to view the stack trace,f3 view variables and parameter values.
But this method used a bit, often will die, do not know why, so found on the Internet another method:
Increase in _VIMRC
Python << eofimport timeimport vimdef setbreakpoint (): nLine = Int (Vim.eval (' Line (") ')) StrLine = Vim.current.line i = 0 Strwhite = "while strline[i] = = ' or strline[i] = =" \ T ": i + = 1 Strwhite + = Strline[i] Vim.current.buffer.append ("% (space) spdb.set_trace ()% (Mark) s breakpoint% (Mark) S"% {' Space ': strwhite, ' Mark ': ' # ' * +}, nLine-1) for strLine in vim.current.buffer:if strLine = = ' Import p DB ": Break Else:vim.current.buffer.append (' import pdb ', 0) vim.command (' Normal J1 ') Breakvim.command (' map <C-M>:p y setbreakpoint () <cr> ') def removebreakpoints (): Ncurrentlin e = Int (Vim.eval (' Line (") ')) Nlines = [] NLine = 1 for strLine in vim.current.buffer:if strLine = = ' Import pdb ' or Strline.lstrip () [: 15] = = ' Pdb.set_trace () ': Nlines.append (nLine) NLine + 1 nlines.reverse () for nLine in Nlines: Vim.Command (' normal%DG '% nLine) vim.command (' normal dd ') if NLine < Ncurrentline:ncurrentline -= 1 Vim.command (' normal%dg '% ncurrentline) vim.command (' map <C-U>:p y removebreakpoints () <cr> ') vim.com Mand (' map <C-D>:!python%<cr> ') EOF
Then use CTRL-M to set breakpoints in the code you want to debug.
Ctrl-d Run
13.Python code Check
Download Pyflakes, unzip the Pyflakes.vim file and pyflakes directory copy set Ftplugin\python directory , open a problematic Python source code file, execute command: CC, you can check the code:
"Go" GVIM development environment Configuration Note--windows