Home VIM ropevim = vim + rope + python

ropevim = vim + rope + python

by admin

For the python-developer and vim-user in one person, ropevim has a nice surprise.It’s finally possible to seamlessly integrate rope, a python library designed for refactoring, into our favorite editor.For those who have not heard of rope, here is a brief list of some of the features: pretty clever code completion, the ability to rename variables and modules, the ability to jump to an object description wherever it is, auto-import, etc.
All this is based on ropemacs, which is where emacs-like bindings come from.
You can check if a rope is installed with the command :
$ python -c "import rope"
If there is no output, then everything is ok.
If you see a traceback, install with your favorite package manager :
$ sudo apt-get install python-rope
or take fresh from sorsforge
Next, install ropevim(the ropemacs it uses is already enabled):
$ wget downloads.sourceforge.net/rope/ropevim-0.2.tar.gz?use_mirror=dfn
$ tar xvf ropevim-0.2.tar.gz
$ cd ropevim-0.2/
$ sudo python setup.py install
$ cp ropevim.vim ~/.vim/plugin/

Done!
You can read more about the functionality and hotkeys in the README.txt file attached to ropevim. , )
In conclusion, just a quick note on how to curb the autocomplete code for a project (probably the most useful and frequently used feature for many), which does seem human here.
$ echo "let ropevim_vim_completion=1" > > ~/.vimrc
Next, open one of the files with the project code in vim, switch to insert-mode, and type
<C-r> ==RopeCodeAssistInsertMode() ,
after which rope indexes and we are happy. And the final touch – a nice addition not by M-/ and M-?, offered by default, but by the usual taboo. Let’s copy the taken from here (thanks to the author!) into ~/.vimrc:
function! TabWrapperRope()
if strpart(getline('.'), 0, col('.')-1) =~ '^\s*$'
return "\"
else
return "\<C-R> =RopeCodeAssistInsertMode()\"
endif
endfunction
imap <C-R>=TabWrapperRope()

You may also like