mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-07-01 18:39:26 +00:00
Compare commits
1 Commits
revision/d
...
pull/517-a
Author | SHA1 | Date | |
---|---|---|---|
e3696d2c28 |
@ -73,7 +73,7 @@ while (( $# > 0 )); do
|
||||
esac
|
||||
|
||||
(( success = $success > 0 ? $success : $? ))
|
||||
(( $success == 0 && $remove_archive == 0 )) && rm "$1"
|
||||
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
|
||||
shift
|
||||
done
|
||||
|
||||
|
@ -123,10 +123,8 @@ zstyle ':completion:*:*:kill:*' force-list always
|
||||
zstyle ':completion:*:*:kill:*' insert-ids single
|
||||
|
||||
# Man
|
||||
# zstyle ':completion:*:manuals' separate-sections true
|
||||
# zstyle ':completion:*:manuals.(^1*)' insert-sections true
|
||||
zstyle ':completion:*:manuals.*' insert-sections true
|
||||
zstyle ':completion:*:man:*' menu yes select
|
||||
zstyle ':completion:*:manuals' separate-sections true
|
||||
zstyle ':completion:*:manuals.(^1*)' insert-sections true
|
||||
|
||||
# Media Players
|
||||
zstyle ':completion:*:*:mpg123:*' file-patterns '*.(mp3|MP3):mp3\ files *(-/):directories'
|
||||
|
@ -12,7 +12,7 @@ function is-autoloadable {
|
||||
|
||||
# Checks if a name is a command, function, or alias.
|
||||
function is-callable {
|
||||
(( $+commands[$1] || $+functions[$1] || $+aliases[$1] ))
|
||||
(( $+commands[$1] )) || (( $+functions[$1] )) || (( $+aliases[$1] ))
|
||||
}
|
||||
|
||||
# Checks a boolean variable for "true".
|
||||
|
@ -22,3 +22,4 @@ alias brews='brew search'
|
||||
alias brewu='brew upgrade'
|
||||
alias brewU='brew update && brew upgrade'
|
||||
alias brewx='brew remove'
|
||||
|
||||
|
@ -61,6 +61,29 @@ system site-packages directory.
|
||||
|
||||
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
|
||||
|
||||
### Settings
|
||||
|
||||
#### Lazy loading
|
||||
|
||||
By default, virtualenvwrapper is loaded in lazy mode. This behaviour can be disabled adding the following line to *~/.zpreztorc*:
|
||||
|
||||
zstyle ':prezto:module:python' lazy_venv 'no'
|
||||
|
||||
#### Automatic virtualenv initialization
|
||||
|
||||
To enable autoenv, add the following line to *~/.zpreztorc*:
|
||||
|
||||
zstyle ':prezto:module:python' autoenv 'yes'
|
||||
|
||||
If a virtualenv is active, and was not activated by autoenv, then autoenv does nothing.
|
||||
Otherwise, autoenv activated or deactivates a virtual environment whenever a directory is changed; based on the following priority:
|
||||
|
||||
1. Name specified in a file named *.venv* in the cwd.
|
||||
2. *.venv* file in git root. If folder is inside git repository.
|
||||
3. Name of git root folder.
|
||||
4. No virtualenv.
|
||||
|
||||
|
||||
Aliases
|
||||
-------
|
||||
|
||||
|
@ -31,17 +31,66 @@ if (( ! $+commands[python] && ! $+commands[pyenv] )); then
|
||||
return 1
|
||||
fi
|
||||
|
||||
local venv_script=virtualenvwrapper
|
||||
if zstyle -T ':prezto:module:python' lazy_venv; then
|
||||
venv_script+=_lazy
|
||||
fi
|
||||
|
||||
# Load virtualenvwrapper into the shell session.
|
||||
if (( $+commands[virtualenvwrapper_lazy.sh] )); then
|
||||
if (( $+commands[$venv_script.sh] )); then
|
||||
# Set the directory where virtual environments are stored.
|
||||
export WORKON_HOME="$HOME/.virtualenvs"
|
||||
|
||||
# Disable the virtualenv prompt.
|
||||
VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||
|
||||
source "$commands[virtualenvwrapper_lazy.sh]"
|
||||
source "$commands[$venv_script.sh]"
|
||||
fi
|
||||
|
||||
function autoenv {
|
||||
#Don't run in shell scripts etc.
|
||||
if [[ $ZSH_SUBSHELL -ne 0 ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
#Don't run if currently in virtual env not set by autoenv
|
||||
if (( ($+VIRTUAL_ENV) && !($+AUTOENV) )); then
|
||||
return
|
||||
fi
|
||||
|
||||
local name=""
|
||||
if [[ -f .venv ]]; then
|
||||
#.venv file in current dir gets highest priority
|
||||
name=$(<.venv)
|
||||
elif is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||
local gitroot="$(git rev-parse --show-toplevel 2> /dev/null)"
|
||||
if [ -f "$gitroot/.venv" ]; then
|
||||
#If there is a .venv file in gitroot
|
||||
name=$(<$gitroot/.venv)
|
||||
else
|
||||
#Else use the name of the folder as venv name
|
||||
name=$gitroot:t
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
local venv_name="$VIRTUAL_ENV:t"
|
||||
if [[ $name != $venv_name ]]; then
|
||||
if [[ -z $name ]]; then
|
||||
deactivate && unset AUTOENV
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -d "$WORKON_HOME/$name" ]]; then
|
||||
workon $name && export AUTOENV=1
|
||||
return
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if zstyle -T ':prezto:module:python' autoenv; then
|
||||
add-zsh-hook chpwd autoenv
|
||||
fi
|
||||
#
|
||||
# Aliases
|
||||
#
|
||||
|
@ -57,7 +57,7 @@ FG[none]="$FX[none]"
|
||||
BG[none]="$FX[none]"
|
||||
colors=(black red green yellow blue magenta cyan white)
|
||||
for color in {0..255}; do
|
||||
if (( $color >= 0 && $color < $#colors )); then
|
||||
if (( $color >= 0 )) && (( $color < $#colors )); then
|
||||
index=$(( $color + 1 ))
|
||||
FG[$colors[$index]]="\e[38;5;${color}m"
|
||||
BG[$colors[$index]]="\e[48;5;${color}m"
|
||||
|
Reference in New Issue
Block a user