introduced
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:
CD ~
wget Https://github.com/rkulla/pydiction/archive/master.zip
Unzip Master.zip
MKDIR-PV ~/.vim/tools/pydiction
Cp-r Pydiction-master/pydiction/after ~/.vim
CP Pydiction-master/complete-dict ~/.vim/tools/pydiction
When done, ensure that you have the following structure:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7A/F1/wKioL1bCgwKyWzkzAAAisDuccdM815.png "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 test.py, import the SYS module, press the TAB key, you can find the completion function.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7A/F1/wKiom1bCf8fQSPhoAACJm0sYpPA276.png "title=" VI complement. PNG "alt=" Wkiom1bcf8fqsphoaacjm0syppa276.png "/>
Second, Automatic completion of Python interactive mode :
To write the tab completion script:
[email protected] ~]# cat ~/.pythontab.py import ReadLine, rlcompleter; Readline.parse_and_bind ("Tab:complete") [[email protected] ~]#
To modify a system environment variable:
[Email protected] ~]# cat/etc/profile.d/tab.sh export pythonstartup=~/.pythontab.py[[email protected] ~]# [[Email PR Otected] ~]#. !$ . /etc/profile.d/tab.sh [[Email protected] ~]#
Where!$ is the last parameter that invokes the previous command.
Test completion function:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7A/F1/wKioL1bCjCWCKAEOAAArAgH5SF8532.png "title=" command line completion. png "alt=" Wkiol1bcjcwckaeoaaaragh5sf8532.png "/>
You can see that the completion has been completed successfully.
Conclusion
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 http://timber.blog.51cto.com/7677013/1742396
Automatic completion of Python in Linux environment