python-rope / ropevim

vim mode that uses rope library to provide features like python refactorings and code-assists
GNU General Public License v2.0
249 stars 34 forks source link

How to install on vim8 / pack manager ? #78

Closed charles-fox closed 4 years ago

charles-fox commented 4 years ago

Hi, I just upgraded to vim 8 with has the new pack plugin manager to replace pathogen and vundle. I'm new to this system and struggling to understand how to install ropevim in it. Has anyone does this already and if so would they be able to edit the readme to add a section on how to do it perhaps?

mcepl commented 4 years ago
  1. python3 -mpip install --user rope ropemode

  2. Install ropevim as any other vim plugin from https://github.com/python-rope/ropevim.git URL,

  3. Enter ~/.vim/pack/**/ropevim (wherever your package manager installed the plugin) directory and install it as a Python module via python3 setup.py develop --user.

If you make pull request for changing README so that it properly explains how to do it, I will certainly take a look at it. Thank you in advance.

charles-fox commented 4 years ago

Thanks very much, I have it working now. For anyone else wanting to do this, here are the specific commands I used (on Ubuntu 16.04 with vim8 installed). The trick is, if you install rope,ropemode and ropevim with pip, these are pure python modules which install on the python path, nothing to do with vim at all. Only the single ropevim.vim file needs to be seen by vim, then it runs python and finds the modules. So just put ropevim.vim in ~/.vim and source it without needing any package managers at all:

$ sudo pip3 install rope ropemode ropevim $ wget -P ~/.vim/ https://raw.githubusercontent.com/python-rope/ropevim/master/ftplugin/python_ropevim.vim $ echo "source ~/.vim/python_ropevim.vim" >> ~/.vimrc

(Bu the way, when first testing ropevim: a common Python refactoring gotcha occurs if we use the standard of one class per file, as in Java. Unlike Java, Python treats filenames and imports separately from class names and instantiations. So if we rename a class it will not rename the file and vice versa, these are two separate operations. When we think about it, this is the correct behavior. But it might confuse you if we are testing ropevim for the first time and expect both the class and file names to change.)

mcepl commented 4 years ago

Thank you for the confirmation. I would just strongly suggest to use standard vim packages (:he packages possibly put whole ~/.vim into git repository and individual modules in pack/whatever/start/ would be git submodules for easy upgrade) or even use some vim plugin packager (e.g., I liked https://github.com/kristijanhusak/vim-packager).

charles-fox commented 4 years ago

thanks again. I send a PR with some text from my install commands if you think they are useful. (I am teaching basic vim to students who have not used it before at all so am looking for the simplest possible ways to set things up, trying to avoid scaring anyone with package managers in general at this stage. Other peoples use cases may be different of course.)