References:
1. http://www.cnblogs.com/samwei/archive/2011/04/25/2026211.html
1. Grammar highlighting
To support Python syntax in Vim, plug-in python is required. VIM: this plug-in is located under <Vim installation directory>/<$ vimruntime>/syntax/by default. If you do not find this plug-in this path, you need to go to Python. VIM: enhanced version of the python syntax
Download highlighting script. To enable Vim to recognize the python syntax, add the following in vimrc:
set filetype=pythonau BufNewFile,BufRead *.py,*.pyw setf python
2. indent
Add the following indent-related code to vimrc:
set autoindent " same level indentset smartindent " next level indentset expandtabset tabstop=4set shiftwidth=4set softtabstop=4
3. Project View
An IDE such as Visual Studio or eclipse provides a project view (on the left or right) that allows programmers to redirect between files or classes. You can use ctags and the plug-in tasklist to implement this function in Vim.
- First download exuberant ctags
- Decompress ctags and enter the decompressed directory. Use the following command to compile and install ctags:
./configure && sudo make install
- In this way, ctags are installed under/usr/local/bin. Next, add the following command in vimrc to tell the installation path of VIM ctags:
let Tlist_Ctags_Cmd='/usr/local/bin/ctags'
- Install the tasklist plug-in: Download tasklist. vim and put it in the plugin directory.
- Finally, use the command tlisttoggle to open the taglist window, which is displayed.
4. minibufexplorer
In Visual Studio or eclipse, the cache you open is listed at the top or bottom of the window in the form of a tab. In vim, The minibufexplorer plug-in is used to implement this function. Download minibufexpl. vim and put it in the plugin directory. Add the following command to vimrc:
let g:miniBufExplMapWindowNavVim = 1let g:miniBufExplMapWindowNavArrows = 1let g:miniBufExplMapCTabSwitchBufs = 1let g:miniBufExplModSelTarget = 1
Demonstrate the usage of minibufexplorer:
5. omnicompletion
Support for syntax prompts and Automatic completion is added to vim7. For python, You need to download pythoncomplete. run Vim in the <Vim installation directory>/<$ vimruntime>/autoload/directory, and then add the following command to vimrc:
filetype plugin onset ofu=syntaxcomplete#Completeautocmd FileType python setomnifunc=pythoncomplete#Completeautocmd FileType python runtime! autoload/pythoncomplete.vim
Finally, press Ctrl-x Ctrl-O to open the context menu of the syntax prompt, as shown in: