How to Use tab in vim to complete python code

Source: Internet
Author: User
Pydiction allows you to complete the TAB code in Vim, including standard, custom, and third-party modules and packages. The addition of keywords, BIFs, and Pydiction allows you to complete the TAB code in Vim, including standard, custom, and third-party modules and packages. Plus keywords, BIFs, and strings.

Pydiction consists of three main files:

Python_pydiction.vim -- this file is the Vim plugin file, which implements the TAB complementing function of the Python file.

Complete-dict -- this file is a Vim dictionary file, which contains information such as the Python keyword and module structure. It is a reference file provided by plugin for full-time search.

Pydiction. py -- (optional) This file is a Python script file used to generate a dictionary file. You can execute this script to add more tabs to complete the module.


Usage

=====

Enter some Python keywords, module names, attributes, or method names in Vim, and press the Tab key to display the completion information.

For example, enter

OS. p

Will pop up

OS. pardir

OS. path

OS. pathconf (

OS. pathconf_names

OS. pathsep

OS. pipe (

...


If you find that the result in the TAB completion menu is not what you want, one possible reason is that you have not set Vim to ignore the case. You can set it in the ": set noic" mode.

[How to Install]

In UNIX/LINUX, put python_pydiction.vim ~ /. Vim/after/ftplugin/. if the directory does not exist, manually create it. Vim automatically searches for related files in the directory. Do not put other files except python_pydiction.vim into this directory.

Add the following fields to your vimrc file to enable ftplugins:

Filetype plugin on

Then make sure to set "g: pydiction_location" to point to the full path of your complete-dict file, for example

Let g: pydiction_location = 'C:/vim/vimfiles/ftplugin/pydiction/complete-dict'

For settings, refer

# Unzip pydiction-1.2.zip

# Cp python_pydiction.vim/usr/share/vim/vim70/ftplugin

# Mkdir/usr/share/vim/vim70/pydiction

# Cp complete-dict pydiction. py/usr/share/vim/vim70/pydiction/

# Vi ~ /. Vimrc

...

# Add

Let g: pydiction_location = '/usr/share/vim/vim70/pydiction/complete-dict'

Let g: pydiction_menu_height = 20

Open the python script file. when writing a python program, press the TAB key to activate the auto-completion menu.

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.