How to Use tab in Vim to complete Python code
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 that contains the Python keywords 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 <Tab>
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 the following settings, see
# 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.
Display:
Press Tab
Press Tab
-------------------------------------- Split line --------------------------------------
Build VIM into a simple and practical IDE
Vim Learning Guide
Quick learn Vi Editor
Powerful Vim Editor
Build a Vim Development Environment on CentOS 6.2
Install the highlighted Vim editing tool in CentOS 5.4
Vim tips: C language settings
Set the Vim row number in Ubuntu
Vim editor basic tutorial
-------------------------------------- Split line --------------------------------------
This article permanently updates the link address: