ENV:GVIM Development Environment Configuration Note--windows

Source: Internet
Author: User
Tags stack trace

Transferred from: http://www.cnblogs.com/xiekeli/archive/2012/08/13/2637176.html

Overtime, listen to colleagues mentioned Gvim in the use of Windows, and then suddenly think of a few years ago, internship in the internship company also used Gvim, but don't think why use this tool, so I found a blog, looked, and then in their own computer to re-match the next, the process is as follows.

Environment: WINDOWS7 Flagship edition

1, installation Gvim7.3 : 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:

1 "Configure multi-lingual environment to solve Chinese garbled problem2 3 ifHas ("Multi_byte") 4     "UTF-8 Encoding5     Setencoding=utf-8 6     Settermencoding=utf-8 7     Setformatoptions+=MM8     Setfencs=utf-8, GBK9     ifV:lang =~?'^/(zh/)/|/(ja/)/|/(ko/)' Ten         SetAmbiwidth=Double  One endif A     ifHas ("Win32")  -SOURCE $VIMRUNTIME/Delmenu.vim -SOURCE $VIMRUNTIME/Menu.vim theLanguage 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:

1 Set nu! 2  34Syntaxon5set nobackup

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:

1 " \<[a-za-z_][a-za-z_0-9]*\>[^ ()]*) ("me=e-22"\<[a-za-z_][a-za-z_0-9]*\>\s* ("me= E13 hi cfunction gui=none guifg= #B5A1FF

To reopen the Gvim, the effect is as follows:

4, Installation Ctags

: http://ctags.sourceforge.net/, after unzipping, copy the Ctags.exe in the folder to D:\ProgramFiles\Vim\vim73, and edit the _VIMRC file to add the following:

1 set tags=2set autochdir

The D:\ProgramFiles\Vim\vim73 is then added to the path of the environment variable. Execute the command ctags-r (via cmd or other bash) 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

: http://vim.sourceforge.net/scripts/script.php?script_id=273, unzip with a doc folder and a plugin folder, copying the contents to D:\Program Files\vim\vim73 in the doc and plugin.
Add the following to the _VIMRC file:

1 let tlist_show_one_file=12 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

Set automatic taglist auto-open :

1 let tlist_auto_open=1

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:

1 let g:winmanagerwindowlayout='fileexplorer| TagList'2 nmap <silent> <F8>:wmtoggle<cr>

To set the Winmanager to open automatically:

1 1

Also add a paragraph to the Winmanager.vim:

"if* nested call S:startwindowsmanager () | 1wincmd W endif

Note : If the settings Winmanager automatically open, then the TagList Auto open variable needs to be closed, otherwise two navigation bars will appear.

Open the code file with Gvim, the normal state press F8 can open close, the window is as follows:

The upper left corner is the window of Winmanager browse 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:

1 let g:minibufexplmapctabswitchbufs=12 let g:minibufexplmapwindowsnavvim=1 3 Let g:minibufexplmapwindownavarrows=1

After opening multiple source code files with Gvim:e,

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.


This allows multiple tabs to be toggled

------------------------------------------------------------------------I configure to this------------------------------------------- ----------------------------

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 there is no grep under Windows, you need to download grep for windowshttp://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:

ENV:GVIM Development Environment Configuration Note--windows

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.