This article originates from http://wushank.blog.51cto.com/3489095/1612042
First, Python interactive mode settings
The Python interpreter has simple line editing capabilities. On Unix systems, any Python interpreter may have added the GNU readline Library support, which has features such as sophisticated interactive editing and historical recording. Entering CONTROL-P in the Python main window may be the simplest way to check whether command-line editing is supported. If you make a beep (computer speaker), you can use the command-line editing feature, or if there is no sound, or if the ^p character is displayed, the command-line editing feature is not available; You can only delete the characters you have typed from the current line and re-enter it from the backspace bar.
If the command line editing feature is not available, install the Readline-devel package and install it for reinstallation.
Second, Vim's tab completion
Pydiction:tab-complete your Python code
:
http://www.vim.org/scripts/script.php?script_id=850 Download Pydiction-1.2.3.zip
Pydiction allows you to implement TAB code completion in Vim, including: Standard, Custom, and third-party modules and packages. Plus keywords, bifs, and strings.
Pydiction is comprised of 3 main documents:
Python_pydiction.vim -This file is a vim plugin file that implements the TAB completion function of the Python file.
complete-dict -The file is a Vim dictionary file that contains information such as the Python keyword and the structure of the module. Is the reference file that plugin is looking for when it is complete.
pydiction.py --(optional) The file is a Python script file that is used to generate the dictionary file. Additional TAB completion modules can be added by executing the script.
Usage
=====
Enter a partial Python keyword, module name, attribute, or method name in Vim and press the TAB key to eject 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 results you get in the TAB completion menu are not what you want, one possible reason is that you did not set Vim to ignore case. Can be set by the ": Set Noic" mode.
"How to Install"
Under Unix/linux, put Python_pydiction.vim into ~/.vim/after/ftplugin/, if the directory does not exist manually created, Vim will automatically go to the directory to find the relevant files. Do not put files other than Python_pydiction.vim in the directory.
Add the following fields in your VIMRC file to enable Ftplugins:
FileType plugin on
Be sure to set "G:pydiction_location" to the full path where you placed the Complete-dict file, for example
Let g:pydiction_location = ' c:/vim/vimfiles/ftplugin/pydiction/complete-dict '
People on the Internet to do the following settings can be consulted
# Unzip Pydiction-1.2.3.zip # CP Python_pydiction.vim/root/.vim/after/ftplugin # CP complete-dict pydiction.py/root/pydiction/ # VI ~/.VIMRC ... # Increase '/root/pydiction/complete-dict'= ...
Open the Python script file and, when writing a Python program, press the TAB key to activate the auto-complete menu.
Python interactive mode settings and Vim tab completion