Coacher / vim-virtualenv

Better Python virtual environments support for Vim
2 stars 0 forks source link
python vim vim-plugin virtualenv

vim-virtualenv

This Vim plugin provides a simple way to activate and deactivate Python virtual environments created by the virtualenv tool from a Vim session as well as synchronizes the Vim internal Python sys.path variable with an already active virtual environment.

By default, :python and :python3 commands have access only to the system-wide Python environment. vim-virtualenv changes the Vim internal Python sys.path and environment $PATH and $PYTHONPATH variables so that they refer to the chosen virtual environment, i.e. activates it.

However, :python and :python3 commands will be still tied to, respectively, Python 2 and Python 3 versions that Vim was compiled against.

Note. Since the v2.0.0 release there are no new features planned and there are no known issues. Nevertheless this plugin is still maintained so feel free to file a bug report or a feature request.

Key features

Usage examples

List virtualenvs located inside g:virtualenv#directory:

:VirtualEnvList

List virtualenvs located inside the '/foo/bar' directory:

:VirtualEnvList /foo/bar

Activate the 'foo' virtualenv located inside g:virtualenv#directory:

:VirtualEnvActivate foo

Activate the virtualenv located at '/foo/bar/baz':

:VirtualEnvActivate /foo/bar/baz

Both VirtualEnvActivate and VirtualEnvList commands support <Tab> completion.

Change the current directory to the currently active virtualenv directory:

:VirtualEnvCD

Deactivate the currently active virtualenv:

:VirtualEnvDeactivate

Name of the currently active virtualenv can be shown in the statusline via virtualenv#statusline() function.

For a more detailed help see:

:help virtualenv