Automatic completion of Python in Linux environment

Source: Internet
Author: User


It is essential to improve the efficiency of writing programs and complete the function. For Python, this article describes the completion of two common Linux environments: Vim Edit and Python interaction mode.

One, the completion of vim:

Pydiction Plug-in

Implementation features:

    • Simple python keyword completion

    • Python function completion with parentheses

    • Python Module completion

    • Python module inner function, variable completion

Installation steps:

    1. CD ~

    2. wget Https://

    3. Unzip

    4. MKDIR-PV ~/.vim/tools/pydiction

    5. Cp-r Pydiction-master/pydiction/after ~/.vim

    6. CP Pydiction-master/complete-dict ~/.vim/tools/pydiction

When done, ensure that you have the following structure:

650) this.width=650; "src=" Http:// "title=". VIM structure. png "alt=" Wkiol1bcgwkywzkzaaaisduccdm815.png "/>

To modify a user's vim configuration file:

[Email protected] ~]# vim ~/.vimrcfiletype plugin onlet g:pydiction_location= ' ~/.vim/tools/pydiction/complete-dict '

Test completion function:

Create a new, import the SYS module, press the TAB key, you can find the completion function.

650) this.width=650; "src=" Http:// "title=" VI complement. PNG "alt=" Wkiom1bcf8fqsphoaacjm0syppa276.png "/>

Second, Automatic completion of Python interactive mode :

To write the tab completion script:

[email protected] ~]# cat ~/ import ReadLine, rlcompleter; Readline.parse_and_bind ("Tab:complete") [[email protected] ~]#

To modify a system environment variable:

[Email protected] ~]# cat/etc/profile.d/ export pythonstartup=~/[[email protected] ~]# [[Email PR  Otected] ~]#.  !$        . /etc/profile.d/ [[Email protected] ~]#

Where!$ is the last parameter that invokes the previous command.

Test completion function:

650) this.width=650; "src=" Http:// "title=" command line completion. png "alt=" Wkiol1bcjcwckaeoaaaragh5sf8532.png "/>

You can see that the completion has been completed successfully.


The Python completion feature in the Linux environment has come to an edge, and the rest is how we developed our operations tools with the Python tool. The back of the road came slowly.

Attached: If you have questions about the above description, look forward to discussing with your friends. I qq:1084569767

This article is from the "home of small Mosquitoes" blog, be sure to keep this source

Automatic completion of Python in Linux environment

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: 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.