Way One:
Ubuntu just installed the command Line Input command is not automatic completion, you can make the following changes to add command line command auto-completion function.
Modify the /etc/bash.bashrc file
if [-f/usr/share/bash-completion/bash_completion]; Then /usr/share/bash-completion/bash_completion elif [-f/etc/bash_completion]; Then /etc/bash_completion fi
Uncomment the above lines of code, save it, and use auto-completion when you open the command line again.
Mode two
1. Get the Python directory "I'm using a 64-bit Ubuntu system"
- [~$]python
- Python 2.7. 3 (default, APR , £ º)
- [GCC 4.6. 3] on linux2
- Type "Help", "copyright", "credits" or "license" for more information.
- >>> Import sys
- >>> Sys.path
- [', '/usr/lib/python2.7 ', '/usr/lib/python2.7/plat-linux2 ', '/usr/lib/python2.7/lib-tk ', '/ Usr/lib/python2.7/lib-old ',
- '/usr/lib/python2.7/lib-dynload ', '/usr/local/lib/python2.7/dist-packages ', '/usr/lib/python2.7/ Dist-packages ',
- '/usr/lib/python2.7/dist-packages/pil ', '/usr/lib/python2.7/dist-packages/gst-0.10 ', '/usr/lib/ Python2.7/dist-packages/gtk-2.0 ',
- '/usr/lib/python2.7/dist-packages/ubuntu-sso-client ', '/usr/lib/python2.7/dist-packages/ubuntuone-client ',
- '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel ', '/usr/lib/python2.7/dist-packages/ Ubuntuone-couch ',
- '/usr/lib/python2.7/dist-packages/ubuntuone-installer ', '/usr/lib/python2.7/dist-packages/ Ubuntuone-storage-protocol ']
- >>>
From the above, I see that the path of Python on my computer is/usr/lib/python2.7.
2. Switch to the directory to write a startup.py script, the script directory is to process the Python <tab> events, the script content is as follows
- #!/usr/bin/python
- # Python startup file
- Import Sys
- Import ReadLine
- Import Rlcompleter
- Import atexit
- Import OS
- # tab Completion
- Readline.parse_and_bind (' tab:complete ')
- # History File
- Histfile = Os.path.join (os.environ[' HOME '), '. Pythonhistory ')
- Try
- Readline.read_history_file (Histfile)
- Except IOError:
- Pass
- Atexit.register (Readline.write_history_file, Histfile)
- Del os, Histfile, ReadLine, Rlcompleter
3. Switch to your home directory
- [/USR/LIB/PYTHON2.7$]CD
- [~$]vi. BASHRC
4. Add Environment variables
- #for python
- Export pythonstartup=/usr/lib/python2.7/startup.py
5. Configure environment variables to take effect
[Plain]View Plaincopyprint?
- [~$]source. BASHRC
automatic completion in vim
1. Download the plugin:
: http://download.csdn.net/detail/loovejava/6284225
2. Copy to the appropriate directory
- Unzip Pydiction-1.2.1.zip
- CP Python_pydiction.vim/usr/share/vim/vim73/ftplugin
- Mkdir/usr/share/vim/vim73/pydiction
- CP complete-dict/usr/share/vim/vim73/pydiction/
- CP pydiction.py/usr/share/vim/vim73/pydiction/
3. Modify the VIM configuration file
- Let g:pydiction_location = '/usr/s
Python tab completions