mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
b98c6358bc
6 changed files with 143 additions and 16 deletions
15
oh-my-zsh.sh
15
oh-my-zsh.sh
|
|
@ -1,6 +1,5 @@
|
|||
# Check for updates on initial load...
|
||||
if [ "$DISABLE_AUTO_UPDATE" != "true" ]
|
||||
then
|
||||
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
|
||||
/usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh $ZSH/tools/check_for_upgrade.sh
|
||||
fi
|
||||
|
||||
|
|
@ -69,8 +68,7 @@ done
|
|||
unset config_file
|
||||
|
||||
# Load the theme
|
||||
if [ "$ZSH_THEME" = "random" ]
|
||||
then
|
||||
if [ "$ZSH_THEME" = "random" ]; then
|
||||
themes=($ZSH/themes/*zsh-theme)
|
||||
N=${#themes[@]}
|
||||
((N=(RANDOM%N)+1))
|
||||
|
|
@ -78,13 +76,10 @@ then
|
|||
source "$RANDOM_THEME"
|
||||
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
|
||||
else
|
||||
if [ ! "$ZSH_THEME" = "" ]
|
||||
then
|
||||
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]
|
||||
then
|
||||
if [ ! "$ZSH_THEME" = "" ]; then
|
||||
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then
|
||||
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
|
||||
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]
|
||||
then
|
||||
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then
|
||||
source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
|
||||
else
|
||||
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
|
||||
|
|
|
|||
99
plugins/chruby/chruby.plugin.zsh
Normal file
99
plugins/chruby/chruby.plugin.zsh
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
#
|
||||
# INSTRUCTIONS
|
||||
#
|
||||
# With either a manual or brew installed chruby things should just work.
|
||||
#
|
||||
# If you'd prefer to specify an explicit path to load chruby from
|
||||
# you can set variables like so:
|
||||
#
|
||||
# zstyle :omz:plugins:chruby path /local/path/to/chruby.sh
|
||||
# zstyle :omz:plugins:chruby auto /local/path/to/auto.sh
|
||||
#
|
||||
# TODO
|
||||
# - autodetermine correct source path on non OS X systems
|
||||
# - completion if ruby-install exists
|
||||
|
||||
# rvm and rbenv plugins also provide this alias
|
||||
alias rubies='chruby'
|
||||
|
||||
local _chruby_path
|
||||
local _chruby_auto
|
||||
|
||||
_homebrew-installed() {
|
||||
whence brew &> /dev/null
|
||||
}
|
||||
|
||||
_chruby-from-homebrew-installed() {
|
||||
brew --prefix chruby &> /dev/null
|
||||
}
|
||||
|
||||
_ruby-build_installed() {
|
||||
whence ruby-build &> /dev/null
|
||||
}
|
||||
|
||||
_ruby-install-installed() {
|
||||
whence ruby-install &> /dev/null
|
||||
}
|
||||
|
||||
# Simple definition completer for ruby-build
|
||||
if _ruby-build_installed; then
|
||||
_ruby-build() { compadd $(ruby-build --definitions) }
|
||||
compdef _ruby-build ruby-build
|
||||
fi
|
||||
|
||||
_source_from_omz_settings() {
|
||||
zstyle -s :omz:plugins:chruby path _chruby_path
|
||||
zstyle -s :omz:plugins:chruby auto _chruby_auto
|
||||
|
||||
if _chruby_path && [[ -r _chruby_path ]]; then
|
||||
source ${_chruby_path}
|
||||
fi
|
||||
|
||||
if _chruby_auto && [[ -r _chruby_auto ]]; then
|
||||
source ${_chruby_auto}
|
||||
fi
|
||||
}
|
||||
|
||||
_chruby_dirs() {
|
||||
chrubydirs=($HOME/.rubies/ $PREFIX/opt/rubies)
|
||||
for dir in chrubydirs; do
|
||||
if [[ -d $dir ]]; then
|
||||
RUBIES+=$dir
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if _homebrew-installed && _chruby-from-homebrew-installed ; then
|
||||
source $(brew --prefix chruby)/share/chruby/chruby.sh
|
||||
source $(brew --prefix chruby)/share/chruby/auto.sh
|
||||
_chruby_dirs
|
||||
elif [[ -r "/usr/local/share/chruby/chruby.sh" ]] ; then
|
||||
source /usr/local/share/chruby/chruby.sh
|
||||
source /usr/local/share/chruby/auto.sh
|
||||
_chruby_dirs
|
||||
else
|
||||
_source_from_omz_settings
|
||||
_chruby_dirs
|
||||
fi
|
||||
|
||||
function ensure_chruby() {
|
||||
$(whence chruby)
|
||||
}
|
||||
|
||||
function current_ruby() {
|
||||
local _ruby
|
||||
_ruby="$(chruby |grep \* |tr -d '* ')"
|
||||
if [[ $(chruby |grep -c \*) -eq 1 ]]; then
|
||||
echo ${_ruby}
|
||||
else
|
||||
echo "system"
|
||||
fi
|
||||
}
|
||||
|
||||
function chruby_prompt_info() {
|
||||
echo "$(current_ruby)"
|
||||
}
|
||||
|
||||
# complete on installed rubies
|
||||
_chruby() { compadd $(chruby | tr -d '* ') }
|
||||
compdef _chruby chruby
|
||||
|
|
@ -23,8 +23,10 @@ _1st_arguments=(
|
|||
"auth\:login":"log in with your heroku credentials"
|
||||
"auth\:logout":"clear local authentication credentials"
|
||||
"config":"display the config vars for an app"
|
||||
"config\:add":"add one or more config vars"
|
||||
"config\:remove":"remove a config var"
|
||||
"config\:pull":"pull heroku config vars down to the local environment"
|
||||
"config\:push":"push local config vars to heroku"
|
||||
"config\:set":"set one or more config vars"
|
||||
"config\:unset":"unset one or more config vars"
|
||||
"db\:push":"push local data up to your app"
|
||||
"db\:pull":"pull heroku data down into your local database"
|
||||
"domains":"list custom domains for an app"
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ _pass_cmd_show () {
|
|||
_pass_complete_entries_helper () {
|
||||
local IFS=$'\n'
|
||||
local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
|
||||
_values -C 'passwords' $(find "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort)
|
||||
_values -C 'passwords' $(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort)
|
||||
}
|
||||
|
||||
_pass_complete_entries_with_subdirs () {
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ zsh-pip-clear-cache() {
|
|||
}
|
||||
|
||||
zsh-pip-clean-packages() {
|
||||
sed -nr '/<a href/ s/.*>([^<]+).*/\1/p'
|
||||
sed -n '/<a href/ s/.*>\([^<]\{1,\}\).*/\1/p'
|
||||
}
|
||||
|
||||
zsh-pip-cache-packages() {
|
||||
if [[ ! -d ${PIP_CACHE_FILE:h} ]]; then
|
||||
mkdir -p ${PIP_CACHE_FILE:h}
|
||||
if [[ ! -d ${ZSH_PIP_CACHE_FILE:h} ]]; then
|
||||
mkdir -p ${ZSH_PIP_CACHE_FILE:h}
|
||||
fi
|
||||
|
||||
if [[ ! -f $ZSH_PIP_CACHE_FILE ]]; then
|
||||
|
|
|
|||
31
plugins/pyenv/pyenv.plugin.zsh
Normal file
31
plugins/pyenv/pyenv.plugin.zsh
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
_homebrew-installed() {
|
||||
type brew &> /dev/null
|
||||
}
|
||||
|
||||
_pyenv-from-homebrew-installed() {
|
||||
brew --prefix pyenv &> /dev/null
|
||||
}
|
||||
|
||||
FOUND_PYENV=0
|
||||
pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv")
|
||||
if _homebrew-installed && _pyenv-from-homebrew-installed ; then
|
||||
pyenvdirs=($(brew --prefix pyenv) "${pyenvdirs[@]}")
|
||||
fi
|
||||
|
||||
for pyenvdir in "${pyenvdirs[@]}" ; do
|
||||
if [ -d $pyenvdir/bin -a $FOUND_PYENV -eq 0 ] ; then
|
||||
FOUND_PYENV=1
|
||||
export PYENV_ROOT=$pyenvdir
|
||||
export PATH=${pyenvdir}/bin:$PATH
|
||||
eval "$(pyenv init --no-rehash - zsh)"
|
||||
|
||||
function pyenv_prompt_info() {
|
||||
echo "$(pyenv version-name)"
|
||||
}
|
||||
fi
|
||||
done
|
||||
unset pyenvdir
|
||||
|
||||
if [ $FOUND_PYENV -eq 0 ] ; then
|
||||
function pyenv_prompt_info() { echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')" }
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue