VIM configuration for separate environments

322 Views Asked by At

I am trying to create a separate vim environment in order to install python-mode plugin. So I've used -u option to select a vim configuration file for the environment. But I cannot figure out how can I properly assign the runtimepath variable. If I just specify set rtp=~/python-env then vim cannot find my plugins in the environment. Can you please help me figure out how to properly set up this variable?

1

There are 1 best solutions below

0
Ingo Karkat On BEST ANSWER

Your question is pretty vague, and noone has answered yet, so here are some general hints:

  • Instead of using -u vimrc, I would rather define "feature flags" via global variables and set those via --cmd "let g:isPythonMode = 1", and test for the variable (with exists()) in your ~/.vimrc. With this, you don't have the config segregated into multiple parts, and you can even define multiple, independent features in the future, and mix and match them without having to duplicate configuration.
  • If you :set rtp=, you have to specify all the default locations (as listed in :help 'runtimepath'), too. It's easier to just prepend / append additional paths via :set rtp^=my/path / :set rtp+=my/path/after.
  • If I understand you correctly, you only want to enable the python-mode plugin for some sessions. Since version 7.4, Vim can do that, even on-demand after starting, via the :help :packadd command. You just need to install the plugin in a special "optional" location (~/.vim/pack/{some name}/opt/vim-python-mode/).