Configure Python programming for VIM (set-continuous collection)

Source: Internet
Author: User
Tags autoload

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:

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.