📜 ⬆️ ⬇️

ropevim = vim + rope + python

For a python developer and a vim user in one person, ropevim will give a pleasant surprise. Finally, in our favorite editor, painless integration of the rope - python library for refactoring is possible. For those who have not heard of rope, I will briefly list some of the possibilities: quite clever code completion, the ability to rename variables and modules, the ability to go to a description of an object, wherever it is located, auto import, and so on.

All this is based on ropemacs (and from there the legs of emacs-like bindings grow), which proved to be excellent.

Check whether rope is installed using the command:
$ python -c "import rope"
if there is no output, then everything is ok.
If we see treysbek, we set up our favorite package manager:
$ sudo apt-get install python-rope
or we take svezhak sorsfordzha .

Next, install the ropevim (the ropemacs that it uses is already on):
$ 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!
')
About the functionality and hotkeys can be described in detail in the README.txt file attached to the ropevim. ,)

In conclusion, let me just note how quickly curbing the auto-completion of the code for the project (probably the most useful and frequently used feature for many), which here seems human.
$ echo "let ropevim_vim_completion=1" >> ~/.vimrc .
Next, open one of the project code files in vim, go to insert-mode and type
<Cr>==RopeCodeAssistInsertMode() ,
after which the rope indexes, and we rejoice. Well, the final touch is a beautiful addition not according to M- / and M-?, Offered by default, but according to the usual taboo. Copy the piece taken from here (thanks to the author!) In ~ / .vimrc:
function! TabWrapperRope()
if strpart(getline('.'), 0, col('.')-1) =~ '^\s*$'
return "\"
else
return "\<CR>=RopeCodeAssistInsertMode()\"
endif
endfunction

imap <CR>=TabWrapperRope()

Source: https://habr.com/ru/post/56025/


All Articles