Beginning version 7 of vim, it has this nice auto completion feature. It is by default however limited to words that has already been in the current workspace. To use it, simply press
p key while in edit mode. For example:
We can however *teach* vim to autocomplete a whole bunch of other stuffs as well, by using something so called Dictionaries. With this idea we can have auto completion for Python, Ruby, PHP, Bash, and any other programming languages code.
For an example, let’s try to install Python dictionary, by downloading it from here:
The next thing to do is to extract the downloaded file to the appropriate folder:
$ mkdir ~/.vim $ tar xf pydiction-0.5.tar.gz -C ~/.vim
and add this lines to your ~/.vimrc (be sure to replace “/home/user” to your own home directory)
if has("autocmd") autocmd FileType python set complete+=k/home/user/.vim/pydiction-0.5/pydiction isk+=.,( endif " has("autocmd"
and let’s see the result:
There are many other scripts available at Vim’s script page worth trying as well.
Share your thoughts, suggest corrections or just say Hi. Login not required.