Random thoughts shooting out of volatile mind
Python Auto Complete for vim
After struggling arround with lot of editors finally i made up my mind to continue with my old favourite editor vim. I choose Python as my primary language along with C and C++. Coming to the point I know vim 7.0 has auto complete feature but it works only by looking at what is already there in current workspace (content you are editing or creating). After googling a bit I came across this link Python Auto complete script for the vim. But had some trouble in setting up the things quickly. So writing this blog to make any other who want to use vim as their primary editor. :)
1. From the above mentioned link please download the latest pydiction-x.x.zip wr x.x is version.
2. In you home folder create .vim folder (if it doesn't already exists create one) unzip the contents. You will get a directory named pydiction-x.x containing following files
  1. python_pydiction.vim
  2. complete_dict
  3. pydiction.py
python_pydiction.vim is vim script, you should move it to ~/.vim/after/ftplugin/ (again if directory doesn't exist create one ). This is the default location on *nix* systems where vim will be looking for the filtype plugin. Note: Only move the .vim files to this directory
complete-dict is python dictionary containing all python function names. pydiction.py is used to extend this dictionary.
Now you need to create a file .vimrc in your home folder (if such file doesn't exist already)and add the following lines to the beginning of the file

" Enable file type plugins
filetype plugin on
let g:pydiction_location='/home/vasudev/.vim/pydiction-1.2/complete-dict'
First line tells vim to use file type plug-ins from ~/.vim/after/ftplugin and second line tells the location of dictionary file. Note: You can place this file any where in your system. Just give a proper path :)
I'm still customizing the vim editor and will be writing all my customizations here soon so watch out folks ;)

Posted by: copyninja on Sunday, 21 February 2010

blog comments powered by Disqus
Fork me on GitHub