abra zsh config 2.0
This commit is contained in:
@@ -3,6 +3,23 @@ Python
|
||||
|
||||
Enables local Python and local Python package installation.
|
||||
|
||||
Settings
|
||||
--------
|
||||
|
||||
This module supports virtual environments from conda and virtualenvwrapper. By default, only virtualenvwrapper is enabled. To disable virtualenvwrapper, add the following to *zpreztorc*.
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:python' skip-virtualenvwrapper-init 'on'
|
||||
```
|
||||
|
||||
Conda support is enabled by adding the following to *zpreztorc*.
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:python' conda-init 'on'
|
||||
```
|
||||
|
||||
Caution: using conda and virtualenvwrapper at the same time may cause conflicts.
|
||||
|
||||
Local Python Installation
|
||||
-------------------------
|
||||
|
||||
@@ -14,7 +31,7 @@ execution of `pyenv`.
|
||||
|
||||
### Usage
|
||||
|
||||
Install Python versions with `pyenv install` into *~/.pyenv/versions*.
|
||||
Install Python versions with `pyenv install` into `~/.pyenv/versions`.
|
||||
|
||||
Local Package Installation
|
||||
--------------------------
|
||||
@@ -28,43 +45,81 @@ documentation.
|
||||
|
||||
### Usage
|
||||
|
||||
Install packages into the per user site directory with `easy_install --user` or
|
||||
`pip install --user`.
|
||||
Install packages into the per user site directory with `pip install --user`.
|
||||
|
||||
virtualenvwrapper
|
||||
-----------------
|
||||
|
||||
[virtualenvwrapper][2] is a frontend to the popular [virtualenv][3] utility.
|
||||
[`virtualenvwrapper`][2] is a frontend to the popular [`virtualenv`][3] utility.
|
||||
|
||||
virtualenv creates isolated Python environments and virtualenvwrapper provides
|
||||
`virtualenv` creates isolated Python environments and `virtualenvwrapper` provides
|
||||
convenient shell functions to create, switch, and manage them.
|
||||
|
||||
### Usage
|
||||
|
||||
Install virtualenvwrapper.
|
||||
Install `virtualenvwrapper`.
|
||||
|
||||
Virtual environments are stored in *~/.virtualenvs*.
|
||||
Virtual environments are stored in `~/.virtualenvs`.
|
||||
|
||||
There are configuration variables that have to be set to enable certain features.
|
||||
If you wish to use these features, export the variables in *~/.zshenv*
|
||||
If you wish to use these features, export the variables in [`zshenv`][6].
|
||||
|
||||
The variable `$PROJECT_HOME` tells virtualenvwrapper where to place project
|
||||
The variable `$PROJECT_HOME` tells `virtualenvwrapper` where to place project
|
||||
working directories. It must be set and the directory created before `mkproject`
|
||||
is used. Replace *Developer* with your projects directory.
|
||||
|
||||
export PROJECT_HOME="$HOME/Developer"
|
||||
```sh
|
||||
export PROJECT_HOME="$HOME/Developer"
|
||||
```
|
||||
|
||||
The variable `$VIRTUALENVWRAPPER_VIRTUALENV_ARGS` tells virtualenvwrapper what
|
||||
The variable `VIRTUALENVWRAPPER_PYTHON` tells `virtualenvwrapper` to use the
|
||||
specified full path of the `python` interpreter overriding the `$PATH` search.
|
||||
|
||||
```sh
|
||||
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
|
||||
```
|
||||
|
||||
The variable `VIRTUALENVWRAPPER_VIRTUALENV` tells `virtualenvwrapper` to use the
|
||||
specified full path of `virtualenv` binary overriding the `$PATH` search.
|
||||
|
||||
```sh
|
||||
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
|
||||
```
|
||||
|
||||
The variable `$VIRTUALENVWRAPPER_VIRTUALENV_ARGS` tells `virtualenvwrapper` what
|
||||
arguments to pass to `virtualenv`. For example, set the value to
|
||||
*--no-site-packages* to ensure that all new environments are isolated from the
|
||||
`--system-site-packages` to ensure that all new environments have access to the
|
||||
system site-packages directory.
|
||||
|
||||
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
|
||||
```sh
|
||||
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--system-site-packages'
|
||||
```
|
||||
|
||||
### Additional Options
|
||||
|
||||
There is a hook to enable auto-switching to virtualenvs when switching into a
|
||||
directory where the root of the project matches a virtualenv name.
|
||||
|
||||
This can be enabled with:
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:python:virtualenv' auto-switch 'yes'
|
||||
```
|
||||
|
||||
`virtualenvwrapper` is automatically initialized if pre-requisites are met
|
||||
(`$VIRTUALENVWRAPPER_VIRTUALENV` is explicitly set or `virtualenv` is in
|
||||
`$PATH`). This can be disabled with:
|
||||
|
||||
```sh
|
||||
zstyle ':prezto:module:python:virtualenv' initialize 'no'
|
||||
```
|
||||
|
||||
Aliases
|
||||
-------
|
||||
|
||||
- `py` is short for `python`.
|
||||
- `py2` is short for `python2`.
|
||||
- `py3` is short for `python3`.
|
||||
|
||||
Functions
|
||||
---------
|
||||
@@ -84,6 +139,10 @@ following style in the `prompt_name_setup` function.
|
||||
Then add `$python_info[virtualenv]` to `$PROMPT` or `$RPROMPT` and call
|
||||
`python-info` in the `prompt_name_preexec` hook function.
|
||||
|
||||
Similarly, you can use `:prezto:module:python:info:version:format` with `%v` for
|
||||
the version and add `$python_info[version]` to your prompt for the current
|
||||
python version/
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
@@ -97,3 +156,4 @@ Authors
|
||||
[3]: http://pypi.python.org/pypi/virtualenv
|
||||
[4]: https://github.com/yyuu/pyenv
|
||||
[5]: https://github.com/sorin-ionescu/prezto/issues
|
||||
[6]: https://github.com/sorin-ionescu/prezto/blob/master/runcoms/zshenv
|
||||
|
Reference in New Issue
Block a user