Linux under Python set vim and interactive mode auto complement

Source: Internet
Author: User



Operating environment: Aliyun ECS centos6.5_x64



One, vim python automatic complete plug-in pydiction



1. Installation Configuration


wget https://github.com/rkulla/pydiction/archive/master.zip
unzip -q master
mv pydiction-master pydiction
mkdir -p ~/.vim/tools/pydiction
cp -r pydiction/after ~/.vim
cp pydiction/complete-dict ~/.vim/tools/pydiction


What's new in creating ~/.VIMRC is as follows:


#cat ~/.vimrc
filetype plugin on
let g:pydiction_location = ‘~/.vim/tools/pydiction/complete-dict‘


When you edit the Python file with VI, the content appears, indicating that it has been successful.



650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/80/FB/wKiom1dFt__w3TeVAABE9MhYkis869.png "title=" p1.png "alt=" Wkiom1dft__w3tevaabe9mhykis869.png "/>



Second, the interactive mode of automatic completion



1. Installing the ReadLine module


Yum-y Install readline*


2. Create a file ~/.pythonstartup


#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. Add to Environment variables


Export Pythonstartup=~/.pythonstartup


4. Make configuration effective


SOURCE ~/.bash_profile


In vim edit mode, you can see that the auto-completion is now complete.



This article is from the "less stubborn" blog, please be sure to keep this source http://xushaojie.blog.51cto.com/6205370/1783256



Linux under Python set vim and interactive mode auto complement


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: info-contact@alibabacloud.com 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.