mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
Merge branch 'master' of git://github.com/robbyrussell/oh-my-zsh
* 'master' of git://github.com/robbyrussell/oh-my-zsh: (146 commits) auto-upadate feature will now reset the epoch so that if a user doesn't say yes, it won't ask them again for a while. fixes #1240 'rails' command should not be run with bundle exec utilize sublime's embedded command line binary escape whitespace provide plugin for rbfu the ruby version switcher Remove bogus "-" from nomz="ps -aux" alias. Added another path Fix finding git issue. http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script added jexec added plugin for jruby correct the ruby version label for rbenv theme cleanup added first version of my theme af-magic sanitized code according to coding style rbenv plugin now uses 'brew --prefix rbenv' command to find rbenv folder remove readlink call and clean up Explicitly tell rbenv to use zsh Fixed unmached " in yum plugin add --directory flag Updating README to ask people to stop sending themes for now ...
This commit is contained in:
commit
eba5bd7e94
86 changed files with 1204 additions and 268 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -4,5 +4,6 @@ projects.zsh
|
||||||
custom/*
|
custom/*
|
||||||
!custom/example
|
!custom/example
|
||||||
!custom/example.zsh
|
!custom/example.zsh
|
||||||
cache
|
|
||||||
*.swp
|
*.swp
|
||||||
|
!custom/example.zshcache
|
||||||
|
cache/
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
A handful of functions, auto-complete helpers, and stuff that makes you shout...
|
A handful of functions, auto-complete helpers, and stuff that makes you shout...
|
||||||
|
|
||||||
|
|
||||||
bq. "OH MY ZSHELL!"
|
bq. "OH MY ZSHELL!"
|
||||||
|
|
||||||
h2. Setup
|
h2. Setup
|
||||||
|
|
@ -8,6 +9,14 @@ h2. Setup
|
||||||
|
|
||||||
h3. The automatic installer... (do you trust me?)
|
h3. The automatic installer... (do you trust me?)
|
||||||
|
|
||||||
|
You can install this via the command line with either `curl` or `wget`.
|
||||||
|
|
||||||
|
h4. via `curl`
|
||||||
|
|
||||||
|
@curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh@
|
||||||
|
|
||||||
|
h4. via `wget`
|
||||||
|
|
||||||
@wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
|
@wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
|
||||||
|
|
||||||
h3. The manual way
|
h3. The manual way
|
||||||
|
|
@ -48,7 +57,7 @@ the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty fo
|
||||||
h3. Customization
|
h3. Customization
|
||||||
|
|
||||||
If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory.
|
If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory.
|
||||||
If you have many functions which go good together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin.
|
If you have many functions which go well together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin.
|
||||||
If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@.
|
If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@.
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -60,9 +69,13 @@ h2. Help out!
|
||||||
|
|
||||||
I'm far from being a zsh-expert and suspect there are many ways to improve. If you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
|
I'm far from being a zsh-expert and suspect there are many ways to improve. If you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
|
||||||
|
|
||||||
h3. Send us your theme!
|
h3. (Don't) Send us your theme! (for now)
|
||||||
|
|
||||||
|
-I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory.-
|
||||||
|
|
||||||
|
We have enough themes for the time being. Please fork the project and add on in there, you can let people know how to grab it from there.
|
||||||
|
|
||||||
|
|
||||||
I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory.
|
|
||||||
|
|
||||||
h2. Contributors
|
h2. Contributors
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,19 +32,21 @@ zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-dir
|
||||||
cdpath=(.)
|
cdpath=(.)
|
||||||
|
|
||||||
# use /etc/hosts and known_hosts for hostname completion
|
# use /etc/hosts and known_hosts for hostname completion
|
||||||
|
[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
|
||||||
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
|
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
|
||||||
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
|
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
|
||||||
hosts=(
|
hosts=(
|
||||||
|
"$_global_ssh_hosts[@]"
|
||||||
"$_ssh_hosts[@]"
|
"$_ssh_hosts[@]"
|
||||||
"$_etc_hosts[@]"
|
"$_etc_hosts[@]"
|
||||||
`hostname`
|
"$HOST"
|
||||||
localhost
|
localhost
|
||||||
)
|
)
|
||||||
zstyle ':completion:*:hosts' hosts $hosts
|
zstyle ':completion:*:hosts' hosts $hosts
|
||||||
|
|
||||||
# Use caching so that commands like apt and dpkg complete are useable
|
# Use caching so that commands like apt and dpkg complete are useable
|
||||||
zstyle ':completion::complete:*' use-cache 1
|
zstyle ':completion::complete:*' use-cache 1
|
||||||
zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/
|
zstyle ':completion::complete:*' cache-path $ZSH/cache/
|
||||||
|
|
||||||
# Don't complete uninteresting users
|
# Don't complete uninteresting users
|
||||||
zstyle ':completion:*:*:*:users' ignored-patterns \
|
zstyle ':completion:*:*:*:users' ignored-patterns \
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,9 @@ cd () {
|
||||||
|
|
||||||
alias md='mkdir -p'
|
alias md='mkdir -p'
|
||||||
alias rd=rmdir
|
alias rd=rmdir
|
||||||
alias d='dirs -v'
|
alias d='dirs -v | head -10'
|
||||||
|
|
||||||
# mkdir & cd to it
|
# mkdir & cd to it
|
||||||
function mcd() {
|
function mcd() {
|
||||||
mkdir -p "$1" && cd "$1";
|
mkdir -p "$1" && cd "$1";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@ function zsh_stats() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function uninstall_oh_my_zsh() {
|
function uninstall_oh_my_zsh() {
|
||||||
/bin/sh $ZSH/tools/uninstall.sh
|
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
function upgrade_oh_my_zsh() {
|
function upgrade_oh_my_zsh() {
|
||||||
/bin/sh $ZSH/tools/upgrade.sh
|
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
function take() {
|
function take() {
|
||||||
|
|
|
||||||
34
lib/git.zsh
34
lib/git.zsh
|
|
@ -4,15 +4,21 @@ function git_prompt_info() {
|
||||||
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Checks if working tree is dirty
|
# Checks if working tree is dirty
|
||||||
parse_git_dirty() {
|
parse_git_dirty() {
|
||||||
if [[ -n $(git status -s 2> /dev/null) ]]; then
|
local SUBMODULE_SYNTAX=''
|
||||||
|
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
|
||||||
|
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
|
||||||
|
fi
|
||||||
|
if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
|
||||||
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||||
else
|
else
|
||||||
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Checks if there are commits ahead from remote
|
# Checks if there are commits ahead from remote
|
||||||
function git_prompt_ahead() {
|
function git_prompt_ahead() {
|
||||||
if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||||
|
|
@ -62,3 +68,29 @@ git_prompt_status() {
|
||||||
fi
|
fi
|
||||||
echo $STATUS
|
echo $STATUS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#compare the provided version of git to the version installed and on path
|
||||||
|
#prints 1 if input version <= installed version
|
||||||
|
#prints -1 otherwise
|
||||||
|
function git_compare_version() {
|
||||||
|
local INPUT_GIT_VERSION=$1;
|
||||||
|
local INSTALLED_GIT_VERSION
|
||||||
|
INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION});
|
||||||
|
INSTALLED_GIT_VERSION=($(git --version));
|
||||||
|
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
|
||||||
|
|
||||||
|
for i in {1..3}; do
|
||||||
|
if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then
|
||||||
|
echo -1
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo 1
|
||||||
|
}
|
||||||
|
|
||||||
|
#this is unlikely to change so make it all statically assigned
|
||||||
|
POST_1_7_2_GIT=$(git_compare_version "1.7.2")
|
||||||
|
#clean up the namespace slightly by removing the checker function
|
||||||
|
unset -f git_compare_version
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,11 @@ HISTFILE=$HOME/.zsh_history
|
||||||
HISTSIZE=10000
|
HISTSIZE=10000
|
||||||
SAVEHIST=10000
|
SAVEHIST=10000
|
||||||
|
|
||||||
setopt hist_ignore_dups # ignore duplication command history list
|
setopt append_history
|
||||||
setopt share_history # share command history data
|
|
||||||
|
|
||||||
setopt hist_verify
|
|
||||||
setopt inc_append_history
|
|
||||||
setopt extended_history
|
setopt extended_history
|
||||||
setopt hist_expire_dups_first
|
setopt hist_expire_dups_first
|
||||||
|
setopt hist_ignore_dups # ignore duplication command history list
|
||||||
setopt hist_ignore_space
|
setopt hist_ignore_space
|
||||||
|
setopt hist_verify
|
||||||
setopt SHARE_HISTORY
|
setopt inc_append_history
|
||||||
setopt APPEND_HISTORY
|
setopt share_history # share command history data
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
bindkey -e
|
bindkey -e
|
||||||
bindkey '\ew' kill-region
|
bindkey '\ew' kill-region
|
||||||
bindkey -s '\el' "ls\n"
|
bindkey -s '\el' "ls\n"
|
||||||
bindkey -s '\e.' "..\n"
|
|
||||||
bindkey '^r' history-incremental-search-backward
|
bindkey '^r' history-incremental-search-backward
|
||||||
bindkey "^[[5~" up-line-or-history
|
bindkey "^[[5~" up-line-or-history
|
||||||
bindkey "^[[6~" down-line-or-history
|
bindkey "^[[6~" down-line-or-history
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,5 @@ bindkey "^[m" copy-prev-shell-word
|
||||||
setopt long_list_jobs
|
setopt long_list_jobs
|
||||||
|
|
||||||
## pager
|
## pager
|
||||||
export PAGER=less
|
export PAGER="less -R"
|
||||||
export LC_CTYPE=$LANG
|
export LC_CTYPE=$LANG
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,10 @@
|
||||||
#Fully support screen, iterm, and probably most modern xterm and rxvt
|
#Fully support screen, iterm, and probably most modern xterm and rxvt
|
||||||
#Limited support for Apple Terminal (Terminal can't set window or tab separately)
|
#Limited support for Apple Terminal (Terminal can't set window or tab separately)
|
||||||
function title {
|
function title {
|
||||||
[ "$DISABLE_AUTO_TITLE" != "true" ] || return
|
if [[ "$DISABLE_AUTO_TITLE" == "true" ]] || [[ "$EMACS" == *term* ]]; then
|
||||||
if [[ "$TERM" == screen* ]]; then
|
return
|
||||||
|
fi
|
||||||
|
if [[ "$TERM" == screen* ]]; then
|
||||||
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
|
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
|
||||||
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||||
print -Pn "\e]2;$2:q\a" #set window name
|
print -Pn "\e]2;$2:q\a" #set window name
|
||||||
|
|
@ -16,14 +18,18 @@ ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
|
||||||
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
|
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
|
||||||
|
|
||||||
#Appears when you have the prompt
|
#Appears when you have the prompt
|
||||||
function precmd {
|
function omz_termsupport_precmd {
|
||||||
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
|
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
|
||||||
}
|
}
|
||||||
|
|
||||||
#Appears at the beginning of (and during) of command execution
|
#Appears at the beginning of (and during) of command execution
|
||||||
function preexec {
|
function omz_termsupport_preexec {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
setopt extended_glob
|
setopt extended_glob
|
||||||
local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
|
local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
|
||||||
title "$CMD" "%100>...>$2%<<"
|
title "$CMD" "%100>...>$2%<<"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
autoload -U add-zsh-hook
|
||||||
|
add-zsh-hook precmd omz_termsupport_precmd
|
||||||
|
add-zsh-hook preexec omz_termsupport_preexec
|
||||||
|
|
|
||||||
41
oh-my-zsh.sh
41
oh-my-zsh.sh
|
|
@ -13,20 +13,33 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
|
||||||
# TIP: Add files you don't want in git to .gitignore
|
# TIP: Add files you don't want in git to .gitignore
|
||||||
for config_file ($ZSH/lib/*.zsh) source $config_file
|
for config_file ($ZSH/lib/*.zsh) source $config_file
|
||||||
|
|
||||||
# Add all defined plugins to fpath
|
# Set ZSH_CUSTOM to the path where your custom config files
|
||||||
plugin=${plugin:=()}
|
# and plugins exists, or else we will use the default custom/
|
||||||
for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath)
|
if [[ -z "$ZSH_CUSTOM" ]]; then
|
||||||
|
ZSH_CUSTOM="$ZSH/custom"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
is_plugin() {
|
||||||
|
local base_dir=$1
|
||||||
|
local name=$2
|
||||||
|
test -f $base_dir/plugins/$name/$name.plugin.zsh \
|
||||||
|
|| test -f $base_dir/plugins/$name/_$name
|
||||||
|
}
|
||||||
|
# Add all defined plugins to fpath. This must be done
|
||||||
|
# before running compinit.
|
||||||
|
for plugin ($plugins); do
|
||||||
|
if is_plugin $ZSH_CUSTOM $plugin; then
|
||||||
|
fpath=($ZSH_CUSTOM/plugins/$plugin $fpath)
|
||||||
|
elif is_plugin $ZSH $plugin; then
|
||||||
|
fpath=($ZSH/plugins/$plugin $fpath)
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Load and run compinit
|
# Load and run compinit
|
||||||
autoload -U compinit
|
autoload -U compinit
|
||||||
compinit -i
|
compinit -i
|
||||||
|
|
||||||
# Set ZSH_CUSTOM to the path where your custom config files
|
|
||||||
# and plugins exists, or else we will use the default custom/
|
|
||||||
if [ "$ZSH_CUSTOM" = "" ]
|
|
||||||
then
|
|
||||||
ZSH_CUSTOM="$ZSH/custom"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Load all of the plugins that were defined in ~/.zshrc
|
# Load all of the plugins that were defined in ~/.zshrc
|
||||||
for plugin ($plugins); do
|
for plugin ($plugins); do
|
||||||
|
|
@ -38,7 +51,7 @@ for plugin ($plugins); do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Load all of your custom configurations from custom/
|
# Load all of your custom configurations from custom/
|
||||||
for config_file ($ZSH_CUSTOM/*.zsh) source $config_file
|
for config_file ($ZSH_CUSTOM/*.zsh(N)) source $config_file
|
||||||
|
|
||||||
# Load the theme
|
# Load the theme
|
||||||
if [ "$ZSH_THEME" = "random" ]
|
if [ "$ZSH_THEME" = "random" ]
|
||||||
|
|
@ -52,7 +65,11 @@ then
|
||||||
else
|
else
|
||||||
if [ ! "$ZSH_THEME" = "" ]
|
if [ ! "$ZSH_THEME" = "" ]
|
||||||
then
|
then
|
||||||
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
|
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]
|
||||||
|
then
|
||||||
|
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
|
||||||
|
else
|
||||||
|
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ if [[ -x `which yaourt` ]]; then
|
||||||
alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
|
alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
|
||||||
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
||||||
alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
|
alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
|
||||||
|
alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation
|
||||||
alias yain='yaourt -S' # Install specific package(s) from the repositories
|
alias yain='yaourt -S' # Install specific package(s) from the repositories
|
||||||
alias yains='yaourt -U' # Install specific package not from the repositories but from a file
|
alias yains='yaourt -U' # Install specific package not from the repositories but from a file
|
||||||
alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
|
alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
if [ -f `brew --prefix`/etc/autojump ]; then
|
if [ $commands[autojump] ]; then # check if autojump is installed
|
||||||
. `brew --prefix`/etc/autojump
|
if [ -f /usr/share/autojump/autojump.zsh ]; then # debian and ubuntu package
|
||||||
|
. /usr/share/autojump/autojump.zsh
|
||||||
|
elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
|
||||||
|
. /etc/profile.d/autojump.zsh
|
||||||
|
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump ]; then # mac os x with brew
|
||||||
|
. `brew --prefix`/etc/autojump
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
20
plugins/battery/battery.plugin.zsh
Normal file
20
plugins/battery/battery.plugin.zsh
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||||
|
function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" }
|
||||||
|
function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') }
|
||||||
|
function battery_pct_prompt() {
|
||||||
|
b=$(battery_pct_remaining)
|
||||||
|
if [ $b -gt 50 ] ; then
|
||||||
|
color='green'
|
||||||
|
elif [ $b -gt 20 ] ; then
|
||||||
|
color='yellow'
|
||||||
|
else
|
||||||
|
color='red'
|
||||||
|
fi
|
||||||
|
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
error_msg='no battery'
|
||||||
|
function battery_pct_remaining() { echo $error_msg }
|
||||||
|
function battery_time_remaining() { echo $error_msg }
|
||||||
|
function battery_pct_prompt() { echo '' }
|
||||||
|
fi
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
fpath=($ZSH/plugins/bundler $fpath)
|
|
||||||
autoload -U compinit
|
|
||||||
compinit -i
|
|
||||||
|
|
||||||
alias be="bundle exec"
|
alias be="bundle exec"
|
||||||
alias bi="bundle install"
|
alias bi="bundle install"
|
||||||
alias bl="bundle list"
|
alias bl="bundle list"
|
||||||
|
|
@ -10,7 +6,7 @@ alias bu="bundle update"
|
||||||
|
|
||||||
# The following is based on https://github.com/gma/bundler-exec
|
# The following is based on https://github.com/gma/bundler-exec
|
||||||
|
|
||||||
bundled_commands=(cap capify cucumber foreman guard heroku nanoc rackup rails rainbows rake rspec ruby shotgun spec spork thin unicorn unicorn_rails)
|
bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails)
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
|
|
@ -20,7 +16,7 @@ _bundler-installed() {
|
||||||
|
|
||||||
_within-bundled-project() {
|
_within-bundled-project() {
|
||||||
local check_dir=$PWD
|
local check_dir=$PWD
|
||||||
while [ "$(dirname $check_dir)" != "/" ]; do
|
while [ $check_dir != "/" ]; do
|
||||||
[ -f "$check_dir/Gemfile" ] && return
|
[ -f "$check_dir/Gemfile" ] && return
|
||||||
check_dir="$(dirname $check_dir)"
|
check_dir="$(dirname $check_dir)"
|
||||||
done
|
done
|
||||||
|
|
@ -41,6 +37,6 @@ for cmd in $bundled_commands; do
|
||||||
alias $cmd=bundled_$cmd
|
alias $cmd=bundled_$cmd
|
||||||
|
|
||||||
if which _$cmd > /dev/null 2>&1; then
|
if which _$cmd > /dev/null 2>&1; then
|
||||||
compdef _$cmd bundled_$cmd
|
compdef _$cmd bundled_$cmd=$cmd
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -40,21 +40,24 @@ alias ap='apt-cache policy'
|
||||||
# superuser operations ######################################################
|
# superuser operations ######################################################
|
||||||
if [[ $use_sudo -eq 1 ]]; then
|
if [[ $use_sudo -eq 1 ]]; then
|
||||||
# commands using sudo #######
|
# commands using sudo #######
|
||||||
alias aac="sudo $apt_pref autoclean"
|
alias aac='sudo $apt_pref autoclean'
|
||||||
alias abd="sudo $apt_pref build-dep"
|
alias abd='sudo $apt_pref build-dep'
|
||||||
alias ac="sudo $apt_pref clean"
|
alias ac='sudo $apt_pref clean'
|
||||||
alias ad="sudo $apt_pref update"
|
alias ad='sudo $apt_pref update'
|
||||||
alias adg="sudo $apt_pref update && sudo $apt_pref upgrade"
|
alias adg='sudo $apt_pref update && sudo $apt_pref upgrade'
|
||||||
alias adu="sudo $apt_pref update && sudo $apt_pref dist-upgrade"
|
alias adu='sudo $apt_pref update && sudo $apt_pref dist-upgrade'
|
||||||
alias afu='sudo apt-file update'
|
alias afu='sudo apt-file update'
|
||||||
alias ag="sudo $apt_pref upgrade"
|
alias ag='sudo $apt_pref upgrade'
|
||||||
alias ai="sudo $apt_pref install"
|
alias ai='sudo $apt_pref install'
|
||||||
alias ap="sudo $apt_pref purge"
|
# Install all packages given on the command line while using only the first word of each line:
|
||||||
alias ar="sudo $apt_pref remove"
|
# acs ... | ail
|
||||||
|
alias ail="sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | "' xargs sudo $apt_pref install'
|
||||||
|
alias ap='sudo $apt_pref purge'
|
||||||
|
alias ar='sudo $apt_pref remove'
|
||||||
|
|
||||||
# apt-get only
|
# apt-get only
|
||||||
alias ads="sudo $apt_pref dselect-upgrade"
|
alias ads='sudo $apt_pref dselect-upgrade'
|
||||||
|
|
||||||
# Install all .deb files in the current directory.
|
# Install all .deb files in the current directory.
|
||||||
# Warning: you will need to put the glob in single quotes if you use:
|
# Warning: you will need to put the glob in single quotes if you use:
|
||||||
# glob_subst
|
# glob_subst
|
||||||
|
|
@ -67,18 +70,18 @@ if [[ $use_sudo -eq 1 ]]; then
|
||||||
|
|
||||||
# commands using su #########
|
# commands using su #########
|
||||||
else
|
else
|
||||||
alias aac='su -ls "'"$apt_pref"' autoclean" root'
|
alias aac='su -ls \'$apt_pref autoclean\' root'
|
||||||
abd() {
|
abd() {
|
||||||
cmd="su -lc '$apt_pref build-dep $@' root"
|
cmd="su -lc '$apt_pref build-dep $@' root"
|
||||||
print "$cmd"
|
print "$cmd"
|
||||||
eval "$cmd"
|
eval "$cmd"
|
||||||
}
|
}
|
||||||
alias ac='su -ls "'"$apt_pref"' clean" root'
|
alias ac='su -ls \'$apt_pref clean\' root'
|
||||||
alias ad='su -lc "'"$apt_pref"' update" root'
|
alias ad='su -lc \'$apt_pref update\' root'
|
||||||
alias adg='su -lc "'"$apt_pref"' update && aptitude safe-upgrade" root'
|
alias adg='su -lc \'$apt_pref update && aptitude safe-upgrade\' root'
|
||||||
alias adu='su -lc "'"$apt_pref"' update && aptitude dist-upgrade" root'
|
alias adu='su -lc \'$apt_pref update && aptitude dist-upgrade\' root'
|
||||||
alias afu='su -lc "apt-file update"'
|
alias afu='su -lc "apt-file update"'
|
||||||
alias ag='su -lc "'"$apt_pref"' safe-upgrade" root'
|
alias ag='su -lc \'$apt_pref safe-upgrade\' root'
|
||||||
ai() {
|
ai() {
|
||||||
cmd="su -lc 'aptitude -P install $@' root"
|
cmd="su -lc 'aptitude -P install $@' root"
|
||||||
print "$cmd"
|
print "$cmd"
|
||||||
|
|
@ -113,15 +116,12 @@ alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
|
||||||
alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
|
alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Functions #################################################################
|
# Functions #################################################################
|
||||||
# create a simple script that can be used to 'duplicate' a system
|
# create a simple script that can be used to 'duplicate' a system
|
||||||
apt-copy() {
|
apt-copy() {
|
||||||
print '#!/bin/sh'"\n" > apt-copy.sh
|
print '#!/bin/sh'"\n" > apt-copy.sh
|
||||||
|
|
||||||
cmd="$apt_pref install "
|
cmd='$apt_pref install'
|
||||||
|
|
||||||
for p in ${(f)"$(aptitude search -F "%p" --disable-columns \~i)"}; {
|
for p in ${(f)"$(aptitude search -F "%p" --disable-columns \~i)"}; {
|
||||||
cmd="${cmd} ${p}"
|
cmd="${cmd} ${p}"
|
||||||
|
|
@ -132,11 +132,46 @@ apt-copy() {
|
||||||
chmod +x apt-copy.sh
|
chmod +x apt-copy.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Prints apt history
|
||||||
|
# Usage:
|
||||||
|
# apt-history install
|
||||||
|
# apt-history upgrade
|
||||||
|
# apt-history remove
|
||||||
|
# apt-history rollback
|
||||||
|
# apt-history list
|
||||||
|
# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
|
||||||
|
apt-history () {
|
||||||
|
case "$1" in
|
||||||
|
install)
|
||||||
|
zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*)
|
||||||
|
;;
|
||||||
|
upgrade|remove)
|
||||||
|
zgrep --no-filename $1 $(ls -rt /var/log/dpkg*)
|
||||||
|
;;
|
||||||
|
rollback)
|
||||||
|
zgrep --no-filename upgrade $(ls -rt /var/log/dpkg*) | \
|
||||||
|
grep "$2" -A10000000 | \
|
||||||
|
grep "$3" -B10000000 | \
|
||||||
|
awk '{print $4"="$5}'
|
||||||
|
;;
|
||||||
|
list)
|
||||||
|
zcat $(ls -rt /var/log/dpkg*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Parameters:"
|
||||||
|
echo " install - Lists all packages that have been installed."
|
||||||
|
echo " upgrade - Lists all packages that have been upgraded."
|
||||||
|
echo " remove - Lists all packages that have been removed."
|
||||||
|
echo " rollback - Lists rollback information."
|
||||||
|
echo " list - Lists all contains of dpkg logs."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
# Kernel-package building shortcut
|
# Kernel-package building shortcut
|
||||||
kerndeb () {
|
kerndeb () {
|
||||||
# temporarily unset MAKEFLAGS ( '-j3' will fail )
|
# temporarily unset MAKEFLAGS ( '-j3' will fail )
|
||||||
MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
|
MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
|
||||||
print '$MAKEFLAGS set to '"'$MAKEFLAGS'"
|
print '$MAKEFLAGS set to '"'$MAKEFLAGS'"
|
||||||
appendage='-custom' # this shows up in $ (uname -r )
|
appendage='-custom' # this shows up in $ (uname -r )
|
||||||
revision=$(date +"%Y%m%d") # this shows up in the .deb file name
|
revision=$(date +"%Y%m%d") # this shows up in the .deb file name
|
||||||
|
|
|
||||||
10
plugins/dircycle/dircycle.plugin.zsh
Normal file
10
plugins/dircycle/dircycle.plugin.zsh
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
##
|
||||||
|
# dircycle plugin: enables cycling through the directory
|
||||||
|
# stack using Ctrl+Shift+Left/Right
|
||||||
|
|
||||||
|
eval "insert-cycledleft () { zle push-line; LBUFFER='pushd -q +1'; zle accept-line }"
|
||||||
|
zle -N insert-cycledleft
|
||||||
|
bindkey "\e[1;6D" insert-cycledleft
|
||||||
|
eval "insert-cycledright () { zle push-line; LBUFFER='pushd -q -0'; zle accept-line }"
|
||||||
|
zle -N insert-cycledright
|
||||||
|
bindkey "\e[1;6C" insert-cycledright
|
||||||
|
|
@ -12,7 +12,7 @@ dirpersistinstall () {
|
||||||
if grep 'dirpersiststore' ~/.zlogout > /dev/null; then
|
if grep 'dirpersiststore' ~/.zlogout > /dev/null; then
|
||||||
else
|
else
|
||||||
if read -q \?"Would you like to set up your .zlogout file for use with dirspersist? (y/n) "; then
|
if read -q \?"Would you like to set up your .zlogout file for use with dirspersist? (y/n) "; then
|
||||||
echo "# Store dirs stack\n# See ~/.oh-my-zsh/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout
|
echo "# Store dirs stack\n# See $ZSH/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout
|
||||||
else
|
else
|
||||||
echo "If you don't want this message to appear, remove dirspersist from \$plugins"
|
echo "If you don't want this message to appear, remove dirspersist from \$plugins"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -220,3 +220,4 @@ _managepy() {
|
||||||
|
|
||||||
compdef _managepy manage.py
|
compdef _managepy manage.py
|
||||||
compdef _managepy django
|
compdef _managepy django
|
||||||
|
compdef _managepy django-manage
|
||||||
|
|
|
||||||
2
plugins/encode64/encode64.plugin.zsh
Normal file
2
plugins/encode64/encode64.plugin.zsh
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
encode64(){ echo -n $1 | base64 }
|
||||||
|
decode64(){ echo -n $1 | base64 -D }
|
||||||
|
|
@ -78,8 +78,3 @@ function extract() {
|
||||||
|
|
||||||
alias x=extract
|
alias x=extract
|
||||||
|
|
||||||
# add extract completion function to path
|
|
||||||
fpath=($ZSH/plugins/extract $fpath)
|
|
||||||
autoload -U compinit
|
|
||||||
compinit -i
|
|
||||||
|
|
||||||
|
|
|
||||||
6
plugins/fasd/fasd.plugin.zsh
Normal file
6
plugins/fasd/fasd.plugin.zsh
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
if [ $commands[fasd] ]; then # check if fasd is installed
|
||||||
|
eval "$(fasd --init auto)"
|
||||||
|
alias v='f -e vim'
|
||||||
|
alias o='a -e open'
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
@ -110,6 +110,8 @@ __git-flow-release ()
|
||||||
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
|
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
|
||||||
-m'[Use the given tag message]'\
|
-m'[Use the given tag message]'\
|
||||||
-p'[Push to $ORIGIN after performing finish]'\
|
-p'[Push to $ORIGIN after performing finish]'\
|
||||||
|
-k'[Keep branch after performing finish]'\
|
||||||
|
-n"[Don't tag this release]"\
|
||||||
':version:__git_flow_version_list'
|
':version:__git_flow_version_list'
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
@ -162,6 +164,8 @@ __git-flow-hotfix ()
|
||||||
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
|
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
|
||||||
-m'[Use the given tag message]'\
|
-m'[Use the given tag message]'\
|
||||||
-p'[Push to $ORIGIN after performing finish]'\
|
-p'[Push to $ORIGIN after performing finish]'\
|
||||||
|
-k'[Keep branch after performing finish]'\
|
||||||
|
-n"[Don't tag this release]"\
|
||||||
':hotfix:__git_flow_hotfix_list'
|
':hotfix:__git_flow_hotfix_list'
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ alias gup='git fetch && git rebase'
|
||||||
compdef _git gup=git-fetch
|
compdef _git gup=git-fetch
|
||||||
alias gp='git push'
|
alias gp='git push'
|
||||||
compdef _git gp=git-push
|
compdef _git gp=git-push
|
||||||
gdv() { git-diff -w "$@" | view - }
|
gdv() { git diff -w "$@" | view - }
|
||||||
compdef _git gdv=git-diff
|
compdef _git gdv=git-diff
|
||||||
alias gc='git commit -v'
|
alias gc='git commit -v'
|
||||||
compdef _git gc=git-commit
|
compdef _git gc=git-commit
|
||||||
|
|
@ -17,6 +17,7 @@ alias gca='git commit -v -a'
|
||||||
compdef _git gca=git-commit
|
compdef _git gca=git-commit
|
||||||
alias gco='git checkout'
|
alias gco='git checkout'
|
||||||
compdef _git gco=git-checkout
|
compdef _git gco=git-checkout
|
||||||
|
alias gcm='git checkout master'
|
||||||
alias gb='git branch'
|
alias gb='git branch'
|
||||||
compdef _git gb=git-branch
|
compdef _git gb=git-branch
|
||||||
alias gba='git branch -a'
|
alias gba='git branch -a'
|
||||||
|
|
@ -35,6 +36,8 @@ alias ga='git add'
|
||||||
compdef _git ga=git-add
|
compdef _git ga=git-add
|
||||||
alias gm='git merge'
|
alias gm='git merge'
|
||||||
compdef _git gm=git-merge
|
compdef _git gm=git-merge
|
||||||
|
alias grh='git reset HEAD'
|
||||||
|
alias grhh='git reset HEAD --hard'
|
||||||
|
|
||||||
# Git and svn mix
|
# Git and svn mix
|
||||||
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
|
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
|
||||||
|
|
@ -51,6 +54,12 @@ function current_branch() {
|
||||||
echo ${ref#refs/heads/}
|
echo ${ref#refs/heads/}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function current_repository() {
|
||||||
|
|
||||||
|
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
||||||
|
echo $(git remote -v | cut -d':' -f 2)
|
||||||
|
}
|
||||||
|
|
||||||
# these aliases take advantage of the previous function
|
# these aliases take advantage of the previous function
|
||||||
alias ggpull='git pull origin $(current_branch)'
|
alias ggpull='git pull origin $(current_branch)'
|
||||||
compdef ggpull=git
|
compdef ggpull=git
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,17 @@
|
||||||
# Setup hub function for git, if it is available; http://github.com/defunkt/hub
|
# Setup hub function for git, if it is available; http://github.com/defunkt/hub
|
||||||
if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then
|
if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then
|
||||||
# eval `hub alias -s zsh`
|
# eval `hub alias -s zsh`
|
||||||
function git(){hub "$@"}
|
function git(){
|
||||||
|
if ! (( $+_has_working_hub )); then
|
||||||
|
hub --version &> /dev/null
|
||||||
|
_has_working_hub=$(($? == 0))
|
||||||
|
fi
|
||||||
|
if (( $_has_working_hub )) ; then
|
||||||
|
hub "$@"
|
||||||
|
else
|
||||||
|
command git "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Functions #################################################################
|
# Functions #################################################################
|
||||||
|
|
|
||||||
14
plugins/jake-node/jake-node.plugin.zsh
Normal file
14
plugins/jake-node/jake-node.plugin.zsh
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#---oh-my-zsh plugin : task Autocomplete for Jake tool---
|
||||||
|
# Jake : https://github.com/mde/jake
|
||||||
|
# Warning : Jakefile should have the right case : Jakefile or jakefile
|
||||||
|
# Tested on : MacOSX 10.7 (Lion), Ubuntu 11.10
|
||||||
|
# Author : Alexandre Lacheze (@al3xstrat)
|
||||||
|
# Inspiration : http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh
|
||||||
|
|
||||||
|
function _jake () {
|
||||||
|
if [ -f Jakefile ]||[ -f jakefile ]; then
|
||||||
|
compadd `jake -T | cut -d " " -f 2 | sed -E "s/.\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"`
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
compdef _jake jake
|
||||||
4
plugins/jruby/jruby.plugin.zsh
Executable file
4
plugins/jruby/jruby.plugin.zsh
Executable file
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Aliases
|
||||||
|
alias jrspec='jruby --debug -S rspec --debug'
|
||||||
|
alias jprofile='jruby --profile.api -S rspec'
|
||||||
|
alias jexec='jruby -S'
|
||||||
|
|
@ -26,7 +26,7 @@ _knife() {
|
||||||
|
|
||||||
case $state in
|
case $state in
|
||||||
knifecmd)
|
knifecmd)
|
||||||
compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders
|
compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec environment index node recipe role search ssh status windows $cloudproviders
|
||||||
;;
|
;;
|
||||||
knifesubcmd)
|
knifesubcmd)
|
||||||
case $words[2] in
|
case $words[2] in
|
||||||
|
|
@ -42,6 +42,9 @@ _knife() {
|
||||||
cookbook)
|
cookbook)
|
||||||
compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
|
compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
|
||||||
;;
|
;;
|
||||||
|
environment)
|
||||||
|
compadd -Q "$@" list create delete edit show "from file"
|
||||||
|
;;
|
||||||
node)
|
node)
|
||||||
compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
|
compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete"
|
||||||
;;
|
;;
|
||||||
|
|
@ -138,27 +141,31 @@ _knife_options3() {
|
||||||
|
|
||||||
# The chef_x_remote functions use knife to get a list of objects of type x on the server
|
# The chef_x_remote functions use knife to get a list of objects of type x on the server
|
||||||
_chef_roles_remote() {
|
_chef_roles_remote() {
|
||||||
(knife role list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
(knife role list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||||
}
|
}
|
||||||
|
|
||||||
_chef_clients_remote() {
|
_chef_clients_remote() {
|
||||||
(knife client list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
(knife client list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||||
}
|
}
|
||||||
|
|
||||||
_chef_nodes_remote() {
|
_chef_nodes_remote() {
|
||||||
(knife node list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
(knife node list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||||
}
|
}
|
||||||
|
|
||||||
_chef_cookbooks_remote() {
|
_chef_cookbooks_remote() {
|
||||||
(knife cookbook list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
(knife cookbook list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||||
}
|
}
|
||||||
|
|
||||||
_chef_sitecookbooks_remote() {
|
_chef_sitecookbooks_remote() {
|
||||||
(knife cookbook site list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
(knife cookbook site list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||||
}
|
}
|
||||||
|
|
||||||
_chef_data_bags_remote() {
|
_chef_data_bags_remote() {
|
||||||
(knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
(knife data bag list --format json | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}')
|
||||||
|
}
|
||||||
|
|
||||||
|
_chef_environments_remote() {
|
||||||
|
(knife environment list | awk '{print $1}')
|
||||||
}
|
}
|
||||||
|
|
||||||
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
|
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ alias iminurbase='finger'
|
||||||
alias btw='nice'
|
alias btw='nice'
|
||||||
alias obtw='nohup'
|
alias obtw='nohup'
|
||||||
|
|
||||||
alias nomz='ps -aux'
|
alias nomz='ps aux'
|
||||||
alias nomnom='killall'
|
alias nomnom='killall'
|
||||||
|
|
||||||
alias byes='exit'
|
alias byes='exit'
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
|
|
||||||
# Mercurial
|
# Mercurial
|
||||||
alias hgc='hg commit -v'
|
alias hgc='hg commit'
|
||||||
alias hgb='hg branch -v'
|
alias hgb='hg branch'
|
||||||
alias hgba='hg branches'
|
alias hgba='hg branches'
|
||||||
alias hgco='hg checkout'
|
alias hgco='hg checkout'
|
||||||
alias hgd='hg diff'
|
alias hgd='hg diff'
|
||||||
alias hged='hg diffmerge'
|
alias hged='hg diffmerge'
|
||||||
# pull and update
|
# pull and update
|
||||||
alias hgl='hg pull -u -v'
|
alias hgl='hg pull -u'
|
||||||
alias hgp='hg push -v'
|
alias hgp='hg push'
|
||||||
alias hgs='hg status -v'
|
alias hgs='hg status'
|
||||||
# this is the 'git commit --amend' equivalent
|
# this is the 'git commit --amend' equivalent
|
||||||
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
|
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
|
||||||
|
|
|
||||||
6
plugins/mvn/mvn.plugin.zsh
Normal file
6
plugins/mvn/mvn.plugin.zsh
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
function listMavenCompletions {
|
||||||
|
reply=(
|
||||||
|
cli:execute cli:execute-phase archetype:generate generate-sources compile clean install test test-compile deploy package cobertura:cobertura jetty:run gwt:run gwt:debug -DskipTests -Dmaven.test.skip=true -DarchetypeCatalog=http://tapestry.formos.com/maven-snapshot-repository -Dtest= `if [ -d ./src ] ; then find ./src -type f | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`);
|
||||||
|
}
|
||||||
|
|
||||||
|
compctl -K listMavenCompletions mvn
|
||||||
5
plugins/nyan/nyan.plugin.zsh
Normal file
5
plugins/nyan/nyan.plugin.zsh
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
if [[ -x `which nc` ]]; then
|
||||||
|
alias nyan='nc -v miku.acm.uiuc.edu 23' # nyan cat
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -3,30 +3,43 @@
|
||||||
|
|
||||||
# pip zsh completion, based on homebrew completion
|
# pip zsh completion, based on homebrew completion
|
||||||
|
|
||||||
|
_pip_all() {
|
||||||
|
# we cache the list of packages (originally from the macports plugin)
|
||||||
|
if (( ! $+piplist )); then
|
||||||
|
echo -n " (caching package index...)"
|
||||||
|
piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]'))
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
_pip_installed() {
|
_pip_installed() {
|
||||||
installed_pkgs=(`pip freeze`)
|
installed_pkgs=(`pip freeze | cut -d '=' -f 1`)
|
||||||
}
|
}
|
||||||
|
|
||||||
local -a _1st_arguments
|
local -a _1st_arguments
|
||||||
_1st_arguments=(
|
_1st_arguments=(
|
||||||
'bundle:Create pybundles (archives containing multiple packages)'
|
'bundle:create pybundles (archives containing multiple packages)'
|
||||||
'freeze:Output all currently installed packages (exact versions) to stdout'
|
'freeze:output all currently installed packages (exact versions) to stdout'
|
||||||
'help:Show available commands'
|
'help:show available commands'
|
||||||
'install:Install packages'
|
'install:install packages'
|
||||||
'search:Search PyPI'
|
'search:search PyPI'
|
||||||
'uninstall:Uninstall packages'
|
'uninstall:uninstall packages'
|
||||||
'unzip:Unzip individual packages'
|
'unzip:unzip individual packages'
|
||||||
'zip:Zip individual packages'
|
'zip:zip individual packages'
|
||||||
)
|
)
|
||||||
|
|
||||||
local expl
|
local expl
|
||||||
local -a pkgs installed_pkgs
|
local -a all_pkgs installed_pkgs
|
||||||
|
|
||||||
_arguments \
|
_arguments \
|
||||||
'(--version)--version[Show version number of program and exit]' \
|
'(--version)--version[show version number of program and exit]' \
|
||||||
'(-v --verbose)'{-v,--verbose}'[Give more output]' \
|
'(-h --help)'{-h,--help}'[show help]' \
|
||||||
'(-q --quiet)'{-q,--quiet}'[Give less output]' \
|
'(-E --environment)'{-E,--environment}'[virtualenv environment to run pip in]' \
|
||||||
'(-h --help)'{-h,--help}'[Show help]' \
|
'(-s --enable-site-packages)'{-s,--enable-site-packages}'[include site-packages in virtualenv]' \
|
||||||
|
'(-v --verbose)'{-v,--verbose}'[give more output]' \
|
||||||
|
'(-q --quiet)'{-q,--quiet}'[give less output]' \
|
||||||
|
'(--log)--log[log file location]' \
|
||||||
|
'(--proxy)--proxy[proxy in form user:passwd@proxy.server:port]' \
|
||||||
|
'(--timeout)--timeout[socket timeout (default 15s)]' \
|
||||||
'*:: :->subcmds' && return 0
|
'*:: :->subcmds' && return 0
|
||||||
|
|
||||||
if (( CURRENT == 1 )); then
|
if (( CURRENT == 1 )); then
|
||||||
|
|
@ -35,10 +48,25 @@ if (( CURRENT == 1 )); then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$words[1]" in
|
case "$words[1]" in
|
||||||
list)
|
search)
|
||||||
if [[ "$state" == forms ]]; then
|
_arguments \
|
||||||
_pip_installed
|
'(--index)--index[base URL of Python Package Index]' ;;
|
||||||
_requested installed_pkgs expl 'installed packages' compadd -a installed_pkgs
|
freeze)
|
||||||
|
_arguments \
|
||||||
|
'(-l --local)'{-l,--local}'[report only virtualenv packages]' ;;
|
||||||
|
install)
|
||||||
|
_arguments \
|
||||||
|
'(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \
|
||||||
|
'(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \
|
||||||
|
'(--no-deps --no-dependencies)'{--no-deps,--no-dependencies}'[iIgnore package dependencies]' \
|
||||||
|
'(--no-install)--no-install[only download packages]' \
|
||||||
|
'(--no-download)--no-download[only install downloaded packages]' \
|
||||||
|
'(--install-option)--install-option[extra arguments to be supplied to the setup.py]' \
|
||||||
|
'1: :->packages' && return 0
|
||||||
|
|
||||||
|
if [[ "$state" == packages ]]; then
|
||||||
|
_pip_all
|
||||||
|
_wanted piplist expl 'packages' compadd -a piplist
|
||||||
fi ;;
|
fi ;;
|
||||||
uninstall)
|
uninstall)
|
||||||
_pip_installed
|
_pip_installed
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,66 @@
|
||||||
# Thanks to Christopher Sexton
|
# Restart a rack app running under pow
|
||||||
# https://gist.github.com/965032
|
# http://pow.cx/
|
||||||
function kapow {
|
#
|
||||||
touch ~/.pow/$1/tmp/restart.txt
|
# Adds a kapow command that will restart an app
|
||||||
if [ $? -eq 0 ]; then
|
#
|
||||||
echo "$fg[yellow]Pow restarting $1...$reset_color"
|
# $ kapow myapp
|
||||||
fi
|
#
|
||||||
|
# Supports command completion.
|
||||||
|
#
|
||||||
|
# If you are not already using completion you might need to enable it with
|
||||||
|
#
|
||||||
|
# autoload -U compinit compinit
|
||||||
|
#
|
||||||
|
# Changes:
|
||||||
|
#
|
||||||
|
# Defaults to the current application, and will walk up the tree to find
|
||||||
|
# a config.ru file and restart the corresponding app
|
||||||
|
#
|
||||||
|
# Will Detect if a app does not exist in pow and print a (slightly) helpful
|
||||||
|
# error message
|
||||||
|
|
||||||
|
rack_root_detect(){
|
||||||
|
setopt chaselinks
|
||||||
|
local orgdir=$(pwd)
|
||||||
|
local basedir=$(pwd)
|
||||||
|
|
||||||
|
while [[ $basedir != '/' ]]; do
|
||||||
|
test -e "$basedir/config.ru" && break
|
||||||
|
builtin cd ".." 2>/dev/null
|
||||||
|
basedir="$(pwd)"
|
||||||
|
done
|
||||||
|
|
||||||
|
builtin cd $orgdir 2>/dev/null
|
||||||
|
[[ ${basedir} == "/" ]] && return 1
|
||||||
|
echo `basename $basedir | sed -E "s/.(com|net|org)//"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kapow(){
|
||||||
|
local vhost=$1
|
||||||
|
[ ! -n "$vhost" ] && vhost=$(rack_root_detect)
|
||||||
|
if [ ! -h ~/.pow/$vhost ]
|
||||||
|
then
|
||||||
|
echo "pow: This domain isn’t set up yet. Symlink your application to ${vhost} first."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ ! -d ~/.pow/${vhost}/tmp ] && mkdir -p ~/.pow/$vhost/tmp
|
||||||
|
touch ~/.pow/$vhost/tmp/restart.txt;
|
||||||
|
[ $? -eq 0 ] && echo "pow: restarting $vhost.dev"
|
||||||
|
}
|
||||||
compctl -W ~/.pow -/ kapow
|
compctl -W ~/.pow -/ kapow
|
||||||
|
|
||||||
|
powit(){
|
||||||
|
local basedir=$(pwd)
|
||||||
|
local vhost=$1
|
||||||
|
[ ! -n "$vhost" ] && vhost=$(rack_root_detect)
|
||||||
|
if [ ! -h ~/.pow/$vhost ]
|
||||||
|
then
|
||||||
|
echo "pow: Symlinking your app with pow. ${vhost}"
|
||||||
|
[ ! -d ~/.pow/${vhost} ] && ln -s $basedir ~/.pow/$vhost
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# View the standard out (puts) from any pow app
|
||||||
|
alias kaput="tail -f ~/Library/Logs/Pow/apps/*"
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,7 @@
|
||||||
alias pyfind='find . -name "*.py"'
|
alias pyfind='find . -name "*.py"'
|
||||||
|
|
||||||
# Remove python compiled byte-code
|
# Remove python compiled byte-code
|
||||||
alias pyclean='find . -type f -name "*.py[co]" -exec rm -f \{\} \;'
|
alias pyclean='find . -type f -name "*.py[co]" -delete'
|
||||||
|
|
||||||
|
# Grep among .py files
|
||||||
|
alias pygrep='grep --include="*.py"'
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ alias ss='thin --stats "/thin/stats" start'
|
||||||
alias sg='ruby script/generate'
|
alias sg='ruby script/generate'
|
||||||
alias sd='ruby script/destroy'
|
alias sd='ruby script/destroy'
|
||||||
alias sp='ruby script/plugin'
|
alias sp='ruby script/plugin'
|
||||||
|
alias sr='ruby script/runner'
|
||||||
alias ssp='ruby script/spec'
|
alias ssp='ruby script/spec'
|
||||||
alias rdbm='rake db:migrate'
|
alias rdbm='rake db:migrate'
|
||||||
alias sc='ruby script/console'
|
alias sc='ruby script/console'
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,11 @@ alias rd='_rails_command destroy'
|
||||||
alias rdb='_rails_command dbconsole'
|
alias rdb='_rails_command dbconsole'
|
||||||
alias rdbm='rake db:migrate db:test:clone'
|
alias rdbm='rake db:migrate db:test:clone'
|
||||||
alias rg='_rails_command generate'
|
alias rg='_rails_command generate'
|
||||||
|
alias rgm='_rails_command generate migration'
|
||||||
alias rp='_rails_command plugin'
|
alias rp='_rails_command plugin'
|
||||||
|
alias ru='_rails_command runner'
|
||||||
alias rs='_rails_command server'
|
alias rs='_rails_command server'
|
||||||
alias rsd='_rails_command server --debugger'
|
alias rsd='_rails_command server --debugger'
|
||||||
alias devlog='tail -f log/development.log'
|
alias devlog='tail -f log/development.log'
|
||||||
|
alias rdm='rake db:migrate'
|
||||||
|
alias rdr='rake db:rollback'
|
||||||
|
|
|
||||||
6
plugins/rake/rake.plugin.zsh
Normal file
6
plugins/rake/rake.plugin.zsh
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
alias rake="noglob rake" # allows square brackts for rake task invocation
|
||||||
|
alias brake='noglob bundle exec rake' # execute the bundled rake gem
|
||||||
|
alias srake='noglob sudo rake' # noglob must come before sudo
|
||||||
|
alias sbrake='noglob sudo bundle exec rake' # altogether now ...
|
||||||
|
|
||||||
|
|
||||||
57
plugins/rbenv/rbenv.plugin.zsh
Normal file
57
plugins/rbenv/rbenv.plugin.zsh
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
_homebrew-installed() {
|
||||||
|
type brew &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
_rbenv-from-homebrew-installed() {
|
||||||
|
brew --prefix rbenv &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
FOUND_RBENV=0
|
||||||
|
rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv")
|
||||||
|
if _homebrew-installed && _rbenv-from-homebrew-installed ; then
|
||||||
|
rbenvdirs=($(brew --prefix rbenv) "${rbenvdirs[@]}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
for rbenvdir in "${rbenvdirs[@]}" ; do
|
||||||
|
if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then
|
||||||
|
FOUND_RBENV=1
|
||||||
|
export RBENV_ROOT=$rbenvdir
|
||||||
|
export PATH=${rbenvdir}/bin:$PATH
|
||||||
|
eval "$(rbenv init - zsh)"
|
||||||
|
|
||||||
|
alias rubies="rbenv versions"
|
||||||
|
alias gemsets="rbenv gemset list"
|
||||||
|
|
||||||
|
function current_ruby() {
|
||||||
|
echo "$(rbenv version-name)"
|
||||||
|
}
|
||||||
|
|
||||||
|
function current_gemset() {
|
||||||
|
echo "$(rbenv gemset active 2&>/dev/null | sed -e ":a" -e '$ s/\n/+/gp;N;b a' | head -n1)"
|
||||||
|
}
|
||||||
|
|
||||||
|
function gems {
|
||||||
|
local rbenv_path=$(rbenv prefix)
|
||||||
|
gem list $@ | sed \
|
||||||
|
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
|
||||||
|
-Ee "s|$(echo $rbenv_path)|$fg[magenta]\$rbenv_path$reset_color|g" \
|
||||||
|
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
||||||
|
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
|
||||||
|
}
|
||||||
|
|
||||||
|
function rbenv_prompt_info() {
|
||||||
|
if [[ -n $(current_gemset) ]] ; then
|
||||||
|
echo "$(current_ruby)@$(current_gemset)"
|
||||||
|
else
|
||||||
|
echo "$(current_ruby)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset rbenvdir
|
||||||
|
|
||||||
|
if [ $FOUND_RBENV -eq 0 ] ; then
|
||||||
|
alias rubies='ruby -v'
|
||||||
|
function gemsets() { echo 'not supported' }
|
||||||
|
function rbenv_prompt_info() { echo "system: $(ruby -v | cut -f-2 -d ' ')" }
|
||||||
|
fi
|
||||||
42
plugins/rbfu/rbfu.plugin.zsh
Normal file
42
plugins/rbfu/rbfu.plugin.zsh
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
# Enables rbfu with --auto option, if available.
|
||||||
|
#
|
||||||
|
# Also provides a command to list all installed/available
|
||||||
|
# rubies. To ensure compatibility with themes, creates the
|
||||||
|
# rvm_prompt_info function to return the $RBFU_RUBY_VERSION
|
||||||
|
# version.
|
||||||
|
|
||||||
|
command -v rbfu &>/dev/null
|
||||||
|
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
eval "$(rbfu --init --auto)"
|
||||||
|
|
||||||
|
# Internal: Print ruby version details, if it's currently
|
||||||
|
# active etc.
|
||||||
|
function _rbfu_rubies_print() {
|
||||||
|
local rb rb_out
|
||||||
|
rb=$(basename $1)
|
||||||
|
rb_out="$rb"
|
||||||
|
[[ -h $1 ]] && rb_out="$rb_out${fg[green]}@${reset_color}"
|
||||||
|
[[ "x$rb" == "x$2" ]] && rb_out="${fg[red]}$rb_out ${fg[red]}*${reset_color}"
|
||||||
|
echo $rb_out
|
||||||
|
}
|
||||||
|
|
||||||
|
# Public: Provide a list with all available rubies, this basically depends
|
||||||
|
# on `ls -1` and .rfbu/rubies. Highlights the currently active ruby version
|
||||||
|
# and aliases.
|
||||||
|
function rbfu-rubies() {
|
||||||
|
local rbfu_dir active_rb
|
||||||
|
rbfu_dir=$RBFU_RUBIES
|
||||||
|
active_rb=$RBFU_RUBY_VERSION
|
||||||
|
[[ -z "$rbfu_dir" ]] && rbfu_dir="${HOME}/.rbfu/rubies"
|
||||||
|
[[ -z "$active_rb" ]] && active_rb="system"
|
||||||
|
_rbfu_rubies_print "${rbfu_dir}/system" $active_rb
|
||||||
|
for rb in $(ls -1 $rbfu_dir); do
|
||||||
|
_rbfu_rubies_print "${rbfu_dir}/${rb}" $active_rb
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Public: Create rvm_prompt_info command for themes compatibility, unless
|
||||||
|
# it has already been defined.
|
||||||
|
[ ! -x rvm_prompt_info ] && function rvm_prompt_info() { echo "${RBFU_RUBY_VERSION:=system}" }
|
||||||
|
fi
|
||||||
|
|
@ -3,4 +3,4 @@
|
||||||
alias sgem='sudo gem'
|
alias sgem='sudo gem'
|
||||||
|
|
||||||
# Find ruby file
|
# Find ruby file
|
||||||
alias rfind='find . -name *.rb | xargs grep -n'
|
alias rfind='find . -name "*.rb" | xargs grep -n'
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ function gems {
|
||||||
local current_gemset=`rvm-prompt g`
|
local current_gemset=`rvm-prompt g`
|
||||||
|
|
||||||
gem list $@ | sed \
|
gem list $@ | sed \
|
||||||
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \
|
-Ee "s/\([0-9, \.]+( .+)?\)/$fg[blue]&$reset_color/g" \
|
||||||
-Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
|
-Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \
|
||||||
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
||||||
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
|
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
|
||||||
|
|
|
||||||
54
plugins/screen/screen.plugin.zsh
Normal file
54
plugins/screen/screen.plugin.zsh
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
# if using GNU screen, let the zsh tell screen what the title and hardstatus
|
||||||
|
# of the tab window should be.
|
||||||
|
if [[ $TERM == "screen" ]]; then
|
||||||
|
if [[ $_GET_PATH == '' ]]; then
|
||||||
|
_GET_PATH='echo $PWD | sed "s/^\/Users\//~/;s/^\/home\//~/;s/^~$USER/~/"'
|
||||||
|
fi
|
||||||
|
if [[ $_GET_HOST == '' ]]; then
|
||||||
|
_GET_HOST='echo $HOST | sed "s/\..*//"'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# use the current user as the prefix of the current tab title
|
||||||
|
TAB_TITLE_PREFIX='"`'$_GET_HOST'`:`'$_GET_PATH' | sed "s:..*/::"`$PROMPT_CHAR"'
|
||||||
|
# when at the shell prompt, show a truncated version of the current path (with
|
||||||
|
# standard ~ replacement) as the rest of the title.
|
||||||
|
TAB_TITLE_PROMPT='$SHELL:t'
|
||||||
|
# when running a command, show the title of the command as the rest of the
|
||||||
|
# title (truncate to drop the path to the command)
|
||||||
|
TAB_TITLE_EXEC='$cmd[1]:t'
|
||||||
|
|
||||||
|
# use the current path (with standard ~ replacement) in square brackets as the
|
||||||
|
# prefix of the tab window hardstatus.
|
||||||
|
TAB_HARDSTATUS_PREFIX='"[`'$_GET_PATH'`] "'
|
||||||
|
# when at the shell prompt, use the shell name (truncated to remove the path to
|
||||||
|
# the shell) as the rest of the title
|
||||||
|
TAB_HARDSTATUS_PROMPT='$SHELL:t'
|
||||||
|
# when running a command, show the command name and arguments as the rest of
|
||||||
|
# the title
|
||||||
|
TAB_HARDSTATUS_EXEC='$cmd'
|
||||||
|
|
||||||
|
# tell GNU screen what the tab window title ($1) and the hardstatus($2) should be
|
||||||
|
function screen_set()
|
||||||
|
{
|
||||||
|
# set the tab window title (%t) for screen
|
||||||
|
print -nR $'\033k'$1$'\033'\\\
|
||||||
|
|
||||||
|
# set hardstatus of tab window (%h) for screen
|
||||||
|
print -nR $'\033]0;'$2$'\a'
|
||||||
|
}
|
||||||
|
# called by zsh before executing a command
|
||||||
|
function preexec()
|
||||||
|
{
|
||||||
|
local -a cmd; cmd=(${(z)1}) # the command string
|
||||||
|
eval "tab_title=$TAB_TITLE_PREFIX:$TAB_TITLE_EXEC"
|
||||||
|
eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX:$TAB_HARDSTATUS_EXEC"
|
||||||
|
screen_set $tab_title $tab_hardstatus
|
||||||
|
}
|
||||||
|
# called by zsh before showing the prompt
|
||||||
|
function precmd()
|
||||||
|
{
|
||||||
|
eval "tab_title=$TAB_TITLE_PREFIX:$TAB_TITLE_PROMPT"
|
||||||
|
eval "tab_hardstatus=$TAB_HARDSTATUS_PREFIX:$TAB_HARDSTATUS_PROMPT"
|
||||||
|
screen_set $tab_title $tab_hardstatus
|
||||||
|
}
|
||||||
|
fi
|
||||||
64
plugins/sprunge/sprunge.plugin.zsh
Normal file
64
plugins/sprunge/sprunge.plugin.zsh
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
# Contributed and SLIGHTLY modded by Matt Parnell/ilikenwf <parwok -at- gmail>
|
||||||
|
# Created by the blogger at the URL below...I don't know where to find his/her name
|
||||||
|
# Original found at http://www.shellperson.net/sprunge-pastebin-script/
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
description | fmt -s >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
description() {
|
||||||
|
cat << HERE
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
Upload data and fetch URL from the pastebin http://sprunge.us
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
$0 filename.txt
|
||||||
|
$0 text string
|
||||||
|
$0 < filename.txt
|
||||||
|
piped_data | $0
|
||||||
|
|
||||||
|
NOTES
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
* INPUT METHODS *
|
||||||
|
$0 can accept piped data, STDIN redirection [<filename.txt], text strings following the command as arguments, or filenames as arguments. Only one of these methods can be used at a time, so please see the note on precedence. Also, note that using a pipe or STDIN redirection will treat tabs as spaces, or disregard them entirely (if they appear at the beginning of a line). So I suggest using a filename as an argument if tabs are important either to the function or readability of the code.
|
||||||
|
|
||||||
|
* PRECEDENCE *
|
||||||
|
STDIN redirection has precedence, then piped input, then a filename as an argument, and finally text strings as an arguments.
|
||||||
|
|
||||||
|
EXAMPLE:
|
||||||
|
echo piped | "$0" arguments.txt < stdin_redirection.txt
|
||||||
|
|
||||||
|
In this example, the contents of file_as_stdin_redirection.txt would be uploaded. Both the piped_text and the file_as_argument.txt are ignored. If there is piped input and arguments, the arguments will be ignored, and the piped input uploaded.
|
||||||
|
|
||||||
|
* FILENAMES *
|
||||||
|
If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but will instead treat it as a text string and upload it.
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
HERE
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
sprunge() {
|
||||||
|
if [ -t 0 ]; then
|
||||||
|
echo Running interactively, checking for arguments... >&2
|
||||||
|
if [ "$*" ]; then
|
||||||
|
echo Arguments present... >&2
|
||||||
|
if [ -f "$*" ]; then
|
||||||
|
echo Uploading the contents of "$*"... >&2
|
||||||
|
cat "$*"
|
||||||
|
else
|
||||||
|
echo Uploading the text: \""$*"\"... >&2
|
||||||
|
echo "$*"
|
||||||
|
fi | curl -F 'sprunge=<-' http://sprunge.us
|
||||||
|
else
|
||||||
|
echo No arguments found, printing USAGE and exiting. >&2
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo Using input from a pipe or STDIN redirection... >&2
|
||||||
|
while read -r line ; do
|
||||||
|
echo $line
|
||||||
|
done | curl -F 'sprunge=<-' http://sprunge.us
|
||||||
|
fi
|
||||||
|
}
|
||||||
9
plugins/sublime/sublime.plugin.zsh
Executable file
9
plugins/sublime/sublime.plugin.zsh
Executable file
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Sublime Text 2 Aliases
|
||||||
|
#unamestr = 'uname'
|
||||||
|
|
||||||
|
if [[ $('uname') == 'Linux' ]]; then
|
||||||
|
alias st='/usr/bin/sublime_text&'
|
||||||
|
elif [[ $('uname') == 'Darwin' ]]; then
|
||||||
|
alias st='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl'
|
||||||
|
fi
|
||||||
|
alias stt='st .'
|
||||||
7
plugins/suse/suse.plugin.zsh
Normal file
7
plugins/suse/suse.plugin.zsh
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
alias zi='sudo zypper install'
|
||||||
|
alias zrf='sudo zypper refresh'
|
||||||
|
alias zs='zypper search'
|
||||||
|
alias zup='sudo zypper dist-upgrade'
|
||||||
|
alias zrm='sudo zypper remove'
|
||||||
|
alias zp='sudo zypper patch'
|
||||||
|
alias zps='sudo zypper ps'
|
||||||
|
|
@ -16,7 +16,7 @@ function svn_get_repo_name {
|
||||||
if [ $(in_svn) ]; then
|
if [ $(in_svn) ]; then
|
||||||
svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
|
svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT
|
||||||
|
|
||||||
svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//"
|
svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
13
plugins/symfony2/symfony2.plugin.zsh
Normal file
13
plugins/symfony2/symfony2.plugin.zsh
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Symfony2 basic command completion
|
||||||
|
|
||||||
|
_symfony2_get_command_list () {
|
||||||
|
app/console --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
|
||||||
|
}
|
||||||
|
|
||||||
|
_symfony2 () {
|
||||||
|
if [ -f app/console ]; then
|
||||||
|
compadd `_symfony2_get_command_list`
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
compdef _symfony2 app/console
|
||||||
|
|
@ -1,37 +1,37 @@
|
||||||
#compdef task
|
#compdef task
|
||||||
#
|
|
||||||
# zsh completion for taskwarrior
|
# zsh completion for taskwarrior
|
||||||
#
|
#
|
||||||
|
# taskwarrior - a command line task list manager.
|
||||||
|
#
|
||||||
# Copyright 2010 - 2011 Johannes Schlatow
|
# Copyright 2010 - 2011 Johannes Schlatow
|
||||||
# Copyright 2009 P.C. Shyamshankar
|
# Copyright 2009 P.C. Shyamshankar
|
||||||
# All rights reserved.
|
|
||||||
#
|
#
|
||||||
# This script is part of the taskwarrior project.
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify it under
|
# The above copyright notice and this permission notice shall be included
|
||||||
# the terms of the GNU General Public License as published by the Free Software
|
# in all copies or substantial portions of the Software.
|
||||||
# Foundation; either version 2 of the License, or (at your option) any later
|
|
||||||
# version.
|
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
# details.
|
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License along with
|
# http://www.opensource.org/licenses/mit-license.php
|
||||||
# this program; if not, write to the
|
|
||||||
#
|
|
||||||
# Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor,
|
|
||||||
# Boston, MA
|
|
||||||
# 02110-1301
|
|
||||||
# USA
|
|
||||||
#
|
#
|
||||||
typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
|
typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers
|
||||||
_task_projects=($(task _projects))
|
_task_projects=($(task _projects))
|
||||||
_task_tags=($(task _tags))
|
_task_tags=($(task _tags))
|
||||||
_task_ids=($(task _ids))
|
_task_ids=($(task _ids))
|
||||||
_task_config=($(task _config))
|
_task_config=($(task _config))
|
||||||
|
_task_columns=($(task _columns))
|
||||||
_task_modifiers=(
|
_task_modifiers=(
|
||||||
'before' \
|
'before' \
|
||||||
'after' \
|
'after' \
|
||||||
|
|
@ -46,39 +46,19 @@ _task_modifiers=(
|
||||||
'word' \
|
'word' \
|
||||||
'noword'
|
'noword'
|
||||||
)
|
)
|
||||||
|
_task_conjunctions=(
|
||||||
|
'and' \
|
||||||
|
'or' \
|
||||||
|
'xor' \
|
||||||
|
'\)'
|
||||||
|
'\('
|
||||||
|
)
|
||||||
_task_cmds=($(task _commands))
|
_task_cmds=($(task _commands))
|
||||||
_task_zshcmds=( ${(f)"$(task _zshcommands)"} )
|
_task_zshcmds=( ${(f)"$(task _zshcommands)"} )
|
||||||
|
|
||||||
|
|
||||||
_task_idCmds=(
|
|
||||||
'append' \
|
|
||||||
'prepend' \
|
|
||||||
'annotate' \
|
|
||||||
'denotate' \
|
|
||||||
'edit' \
|
|
||||||
'duplicate' \
|
|
||||||
'info' \
|
|
||||||
'start' \
|
|
||||||
'stop' \
|
|
||||||
'done'
|
|
||||||
)
|
|
||||||
|
|
||||||
_task_idCmdsDesc=(
|
|
||||||
'append:Appends more description to an existing task.' \
|
|
||||||
'prepend:Prepends more description to an existing task.' \
|
|
||||||
'annotate:Adds an annotation to an existing task.' \
|
|
||||||
'denotate:Deletes an annotation of an existing task.' \
|
|
||||||
'edit:Launches an editor to let you modify a task directly.' \
|
|
||||||
'duplicate:Duplicates the specified task, and allows modifications.' \
|
|
||||||
'info:Shows all data, metadata for specified task.' \
|
|
||||||
'start:Marks specified task as started.' \
|
|
||||||
'stop:Removes the start time from a task.' \
|
|
||||||
'done:Marks the specified task as completed.'
|
|
||||||
)
|
|
||||||
|
|
||||||
_task() {
|
_task() {
|
||||||
_arguments -s -S \
|
_arguments -s -S \
|
||||||
"*::task command:_task_commands"
|
"*::task default:_task_default"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,6 +128,7 @@ _regex_words values 'task frequencies' \
|
||||||
'weekly:Every week' \
|
'weekly:Every week' \
|
||||||
'biweekly:Every two weeks' \
|
'biweekly:Every two weeks' \
|
||||||
'fortnight:Every two weeks' \
|
'fortnight:Every two weeks' \
|
||||||
|
+ 'monthly:Every month' \
|
||||||
'quarterly:Every three months' \
|
'quarterly:Every three months' \
|
||||||
'semiannual:Every six months' \
|
'semiannual:Every six months' \
|
||||||
'annual:Every year' \
|
'annual:Every year' \
|
||||||
|
|
@ -196,22 +177,13 @@ _regex_arguments _task_attributes "${args[@]}"
|
||||||
|
|
||||||
## task commands
|
## task commands
|
||||||
|
|
||||||
# default completion
|
# filter completion
|
||||||
(( $+functions[_task_default] )) ||
|
(( $+functions[_task_filter] )) ||
|
||||||
_task_default() {
|
_task_filter() {
|
||||||
_task_attributes "$@"
|
_task_attributes "$@"
|
||||||
}
|
|
||||||
|
|
||||||
# commands expecting an ID
|
# TODO complete conjunctions only if the previous word is a filter expression, i.e. attribute, ID, any non-command
|
||||||
(( $+functions[_task_id] )) ||
|
_describe -t default 'task conjunctions' _task_conjunctions
|
||||||
_task_id() {
|
|
||||||
if (( CURRENT < 3 )); then
|
|
||||||
# update IDs
|
|
||||||
_task_zshids=( ${(f)"$(task _zshids)"} )
|
|
||||||
_describe -t values 'task IDs' _task_zshids
|
|
||||||
else
|
|
||||||
_task_attributes "$@"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# merge completion
|
# merge completion
|
||||||
|
|
@ -235,46 +207,42 @@ _task_pull() {
|
||||||
_files
|
_files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# execute completion
|
||||||
|
(( $+functions[_task_execute] )) ||
|
||||||
|
_task_execute() {
|
||||||
|
_files
|
||||||
|
}
|
||||||
|
|
||||||
# modify (task [0-9]* ...) completion
|
# id-only completion
|
||||||
(( $+functions[_task_modify] )) ||
|
(( $+functions[_task_id] )) ||
|
||||||
_task_modify() {
|
_task_id() {
|
||||||
_describe -t commands 'task command' _task_idCmdsDesc
|
_describe -t values 'task IDs' _task_zshids
|
||||||
_task_attributes "$@"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
## first level completion => task sub-command completion
|
## first level completion => task sub-command completion
|
||||||
(( $+functions[_task_commands] )) ||
|
(( $+functions[_task_default] )) ||
|
||||||
_task_commands() {
|
_task_default() {
|
||||||
local cmd ret=1
|
local cmd ret=1
|
||||||
if (( CURRENT == 1 )); then
|
|
||||||
# update IDs
|
|
||||||
_task_zshids=( ${(f)"$(task _zshids)"} )
|
|
||||||
|
|
||||||
_describe -t commands 'task command' _task_zshcmds
|
integer i=1
|
||||||
_describe -t values 'task IDs' _task_zshids
|
while (( i < $#words ))
|
||||||
# TODO match more than one ID
|
do
|
||||||
elif [[ $words[1] =~ ^[0-9]*$ ]] then
|
cmd="${_task_cmds[(r)$words[$i]]}"
|
||||||
_call_function ret _task_modify
|
if (( $#cmd )); then
|
||||||
return ret
|
_call_function ret _task_${cmd} ||
|
||||||
else
|
_call_function ret _task_filter ||
|
||||||
# local curcontext="${curcontext}"
|
_message "No command remaining."
|
||||||
# cmd="${_task_cmds[(r)$words[1]:*]%%:*}"
|
return ret
|
||||||
cmd="${_task_cmds[(r)$words[1]]}"
|
fi
|
||||||
idCmd="${(M)_task_idCmds[@]:#$words[1]}"
|
(( i++ ))
|
||||||
if (( $#cmd )); then
|
done
|
||||||
# curcontext="${curcontext%:*:*}:task-${cmd}"
|
|
||||||
|
|
||||||
if (( $#idCmd )); then
|
# update IDs
|
||||||
_call_function ret _task_id
|
_task_zshids=( ${(f)"$(task _zshids)"} )
|
||||||
else
|
|
||||||
_call_function ret _task_${cmd} ||
|
_describe -t commands 'task command' _task_zshcmds
|
||||||
_call_function ret _task_default ||
|
_describe -t values 'task IDs' _task_zshids
|
||||||
_message "No command remaining."
|
_call_function ret _task_filter
|
||||||
fi
|
|
||||||
else
|
return ret
|
||||||
_message "Unknown subcommand ${cmd}"
|
|
||||||
fi
|
|
||||||
return ret
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
11
plugins/terminalapp/terminalapp.plugin.zsh
Normal file
11
plugins/terminalapp/terminalapp.plugin.zsh
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Set Apple Terminal.app resume directory
|
||||||
|
# based on this answer: http://superuser.com/a/315029
|
||||||
|
|
||||||
|
function chpwd {
|
||||||
|
local SEARCH=' '
|
||||||
|
local REPLACE='%20'
|
||||||
|
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
|
||||||
|
printf '\e]7;%s\a' "$PWD_URL"
|
||||||
|
}
|
||||||
|
|
||||||
|
chpwd
|
||||||
46
plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
Normal file
46
plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
WRAPPER_FOUND=0
|
||||||
|
for wrapsource in "/usr/bin/virtualenvwrapper.sh" "/usr/local/bin/virtualenvwrapper.sh" "/etc/bash_completion.d/virtualenvwrapper" ; do
|
||||||
|
if [[ -e $wrapsource ]] ; then
|
||||||
|
WRAPPER_FOUND=1
|
||||||
|
source $wrapsource
|
||||||
|
|
||||||
|
if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
|
||||||
|
# Automatically activate Git projects' virtual environments based on the
|
||||||
|
# directory name of the project. Virtual environment name can be overridden
|
||||||
|
# by placing a .venv file in the project root with a virtualenv name in it
|
||||||
|
function workon_cwd {
|
||||||
|
# Check that this is a Git repo
|
||||||
|
PROJECT_ROOT=`git rev-parse --show-toplevel 2> /dev/null`
|
||||||
|
if (( $? == 0 )); then
|
||||||
|
# Check for virtualenv name override
|
||||||
|
ENV_NAME=`basename "$PROJECT_ROOT"`
|
||||||
|
if [[ -f "$PROJECT_ROOT/.venv" ]]; then
|
||||||
|
ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
|
||||||
|
fi
|
||||||
|
# Activate the environment only if it is not already active
|
||||||
|
if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
|
||||||
|
if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
|
||||||
|
workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif [ $CD_VIRTUAL_ENV ]; then
|
||||||
|
# We've just left the repo, deactivate the environment
|
||||||
|
# Note: this only happens if the virtualenv was activated automatically
|
||||||
|
deactivate && unset CD_VIRTUAL_ENV
|
||||||
|
fi
|
||||||
|
unset PROJECT_ROOT
|
||||||
|
}
|
||||||
|
|
||||||
|
# New cd function that does the virtualenv magic
|
||||||
|
function cd {
|
||||||
|
builtin cd "$@" && workon_cwd
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $WRAPPER_FOUND -eq 0 ] ; then
|
||||||
|
print "zsh virtualenvwrapper plugin: Couldn't activate virtualenvwrapper. Please run \`pip install virtualenvwrapper\`."
|
||||||
|
fi
|
||||||
29
plugins/wakeonlan/README
Normal file
29
plugins/wakeonlan/README
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
This plugin provides a wrapper around the "wakeonlan" tool available from most
|
||||||
|
distributions' package repositories, or from the following website:
|
||||||
|
|
||||||
|
http://gsd.di.uminho.pt/jpo/software/wakeonlan/
|
||||||
|
|
||||||
|
In order to use this wrapper, create the ~/.wakeonlan directory, and place in
|
||||||
|
that directory one file for each device you would like to be able to wake. Give
|
||||||
|
the file a name that describes the device, such as its hostname. Each file
|
||||||
|
should contain a line with the mac address of the target device and the network
|
||||||
|
broadcast address.
|
||||||
|
|
||||||
|
For instance, there might be a file ~/.wakeonlan/leto with the following
|
||||||
|
contents:
|
||||||
|
|
||||||
|
00:11:22:33:44:55:66 192.168.0.255
|
||||||
|
|
||||||
|
To wake that device, use the following command:
|
||||||
|
|
||||||
|
# wake leto
|
||||||
|
|
||||||
|
The available device names will be autocompleted, so:
|
||||||
|
|
||||||
|
# wake <tab>
|
||||||
|
|
||||||
|
...will suggest "leto", along with any other configuration files that were
|
||||||
|
placed in the ~/.wakeonlan directory.
|
||||||
|
|
||||||
|
For more information regarding the configuration file format, check the
|
||||||
|
wakeonlan man page.
|
||||||
4
plugins/wakeonlan/_wake
Normal file
4
plugins/wakeonlan/_wake
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
#compdef wake
|
||||||
|
#autoload
|
||||||
|
|
||||||
|
_arguments "1:device to wake:_files -W '$HOME/.wakeonlan'" && return 0
|
||||||
14
plugins/wakeonlan/wakeonlan.plugin.zsh
Normal file
14
plugins/wakeonlan/wakeonlan.plugin.zsh
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
function wake() {
|
||||||
|
local config_file="$HOME/.wakeonlan/$1"
|
||||||
|
if [[ ! -f "$config_file" ]]; then
|
||||||
|
echo "ERROR: There is no configuration file at \"$config_file\"."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( ! $+commands[wakeonlan] )); then
|
||||||
|
echo "ERROR: Can't find \"wakeonlan\". Are you sure it's installed?"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
wakeonlan -f "$config_file"
|
||||||
|
}
|
||||||
|
|
@ -3,10 +3,14 @@
|
||||||
alias ys="yum search" # search package
|
alias ys="yum search" # search package
|
||||||
alias yp="yum info" # show package info
|
alias yp="yum info" # show package info
|
||||||
alias yl="yum list" # list packages
|
alias yl="yum list" # list packages
|
||||||
|
alias ygl="yum grouplist" # list package groups
|
||||||
alias yli="yum list installed" # print all installed packages
|
alias yli="yum list installed" # print all installed packages
|
||||||
|
alias ymc="yum makecache" # rebuilds the yum package list
|
||||||
|
|
||||||
alias yu="sudo yum update" # upgrate packages
|
alias yu="sudo yum update" # upgrate packages
|
||||||
alias yi="sudo yum install" # install package
|
alias yi="sudo yum install" # install package
|
||||||
|
alias ygi="sudo yum groupinstall" # install package group
|
||||||
alias yr="sudo yum remove" # remove package
|
alias yr="sudo yum remove" # remove package
|
||||||
|
alias ygr="sudo yum groupremove" # remove pagage group
|
||||||
alias yrl="sudo yum remove --remove-leaves" # remove package and leaves
|
alias yrl="sudo yum remove --remove-leaves" # remove package and leaves
|
||||||
alias yc="sudo yum clean all" # clean cache
|
alias yc="sudo yum clean all" # clean cache
|
||||||
|
|
@ -7,6 +7,10 @@ ZSH=$HOME/.oh-my-zsh
|
||||||
# time that oh-my-zsh is loaded.
|
# time that oh-my-zsh is loaded.
|
||||||
ZSH_THEME="robbyrussell"
|
ZSH_THEME="robbyrussell"
|
||||||
|
|
||||||
|
# Example aliases
|
||||||
|
# alias zshconfig="mate ~/.zshrc"
|
||||||
|
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||||
|
|
||||||
# Set to this to use case-sensitive completion
|
# Set to this to use case-sensitive completion
|
||||||
# CASE_SENSITIVE="true"
|
# CASE_SENSITIVE="true"
|
||||||
|
|
||||||
|
|
@ -23,6 +27,7 @@ ZSH_THEME="robbyrussell"
|
||||||
# COMPLETION_WAITING_DOTS="true"
|
# COMPLETION_WAITING_DOTS="true"
|
||||||
|
|
||||||
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
|
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
|
||||||
|
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
|
||||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||||
plugins=(git)
|
plugins=(git)
|
||||||
|
|
||||||
|
|
|
||||||
36
themes/af-magic.zsh-theme
Normal file
36
themes/af-magic.zsh-theme
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
# af-magic.zsh-theme
|
||||||
|
#
|
||||||
|
# Author: Andy Fleming
|
||||||
|
# URL: http://andyfleming.com/
|
||||||
|
# Repo: https://github.com/andyfleming/oh-my-zsh
|
||||||
|
# Direct Link: https://github.com/andyfleming/oh-my-zsh/blob/master/themes/af-magic.zsh-theme
|
||||||
|
#
|
||||||
|
# Created on: June 19, 2012
|
||||||
|
# Last modified on: June 20, 2012
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
|
||||||
|
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
|
|
||||||
|
# primary prompt
|
||||||
|
PROMPT='$FG[237]------------------------------------------------------------%{$reset_color%}
|
||||||
|
$FG[032]%~\
|
||||||
|
$(git_prompt_info) \
|
||||||
|
$FG[105]%(!.#.»)%{$reset_color%} '
|
||||||
|
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
|
||||||
|
RPS1='${return_code}'
|
||||||
|
|
||||||
|
|
||||||
|
# color vars
|
||||||
|
eval my_gray='$FG[237]'
|
||||||
|
eval my_orange='$FG[214]'
|
||||||
|
|
||||||
|
# right prompt
|
||||||
|
RPROMPT='$my_gray%n@%m%{$reset_color%}%'
|
||||||
|
|
||||||
|
# git settings
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075](branch:"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}"
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
|
|
||||||
local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}'
|
local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}'
|
||||||
local pwd='%{$fg[blue]%}%~%{$reset_color%}'
|
local pwd='%{$fg[blue]%}%~%{$reset_color%}'
|
||||||
local rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
|
local rvm=''
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
rvm='%{$fg[green]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})'
|
local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})'
|
||||||
local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}'
|
local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}'
|
||||||
|
|
||||||
|
|
@ -19,4 +26,3 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
|
||||||
|
|
||||||
PROMPT="${user} ${pwd}$ "
|
PROMPT="${user} ${pwd}$ "
|
||||||
RPROMPT="${return_code} ${git_branch} ${rvm}"
|
RPROMPT="${return_code} ${git_branch} ${rvm}"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ function toon {
|
||||||
echo -n ""
|
echo -n ""
|
||||||
}
|
}
|
||||||
|
|
||||||
get_git_dirty() {
|
get_git_dirty() {
|
||||||
git diff --quiet || echo '*'
|
git diff --quiet || echo '*'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -18,9 +18,12 @@ zstyle ':vcs_info:*' formats \
|
||||||
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
|
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
|
||||||
zstyle ':vcs_info:*' enable git cvs svn
|
zstyle ':vcs_info:*' enable git cvs svn
|
||||||
|
|
||||||
precmd () {
|
theme_precmd () {
|
||||||
vcs_info
|
vcs_info
|
||||||
}
|
}
|
||||||
|
|
||||||
setopt prompt_subst
|
setopt prompt_subst
|
||||||
PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}'
|
PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}'
|
||||||
|
|
||||||
|
autoload -U add-zsh-hook
|
||||||
|
add-zsh-hook precmd theme_precmd
|
||||||
|
|
@ -3,7 +3,14 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
|
|
||||||
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
|
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
|
||||||
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
|
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
|
||||||
local rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
|
local rvm_ruby=''
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
local git_branch='$(git_prompt_info)%{$reset_color%}'
|
local git_branch='$(git_prompt_info)%{$reset_color%}'
|
||||||
|
|
||||||
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
|
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,13 @@ ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗"
|
||||||
|
|
||||||
# Our elements:
|
# Our elements:
|
||||||
CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}"
|
CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}"
|
||||||
CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(rbenv version | sed -e 's/ (set.*$//' -e 's/^ruby-//')}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) "
|
CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) "
|
||||||
CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ "
|
CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ "
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,13 @@
|
||||||
# Grab the current date (%D) and time (%T) wrapped in {}: {%D %T}
|
# Grab the current date (%D) and time (%T) wrapped in {}: {%D %T}
|
||||||
DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%D %T%{$fg[white]%}}%{$reset_color%}"
|
DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%D %T%{$fg[white]%}}%{$reset_color%}"
|
||||||
# Grab the current version of ruby in use (via RVM): [ruby-1.8.7]
|
# Grab the current version of ruby in use (via RVM): [ruby-1.8.7]
|
||||||
DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
# Grab the current machine name: muscato
|
# Grab the current machine name: muscato
|
||||||
DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}"
|
DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}"
|
||||||
# Grab the current filepath, use shortcuts: ~/Desktop
|
# Grab the current filepath, use shortcuts: ~/Desktop
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
#RVM settings
|
#RVM settings
|
||||||
if [[ -s ~/.rvm/scripts/rvm ]] ; then
|
if [[ -s ~/.rvm/scripts/rvm ]] ; then
|
||||||
RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1"
|
RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1"
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
RPS1="%{$fg[yellow]%}rbenv:%{$reset_color%}%{$fg[red]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$reset_color%} $EPS1"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}["
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}["
|
||||||
|
|
|
||||||
39
themes/fino-time.zsh-theme
Normal file
39
themes/fino-time.zsh-theme
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
# Fino-time theme by Aexander Berezovsky (http://berezovsky.me) based on Fino by Max Masnick (http://max.masnick.me)
|
||||||
|
|
||||||
|
# Use with a dark background and 256-color terminal!
|
||||||
|
# Meant for people with RVM and git. Tested only on OS X 10.7.
|
||||||
|
|
||||||
|
# You can set your computer name in the ~/.box-name file if you want.
|
||||||
|
|
||||||
|
# Borrowing shamelessly from these oh-my-zsh themes:
|
||||||
|
# bira
|
||||||
|
# robbyrussell
|
||||||
|
#
|
||||||
|
# Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
|
||||||
|
|
||||||
|
function virtualenv_info {
|
||||||
|
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
|
||||||
|
}
|
||||||
|
|
||||||
|
function prompt_char {
|
||||||
|
git branch >/dev/null 2>/dev/null && echo '±' && return
|
||||||
|
echo '○'
|
||||||
|
}
|
||||||
|
|
||||||
|
function box_name {
|
||||||
|
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}'
|
||||||
|
local current_dir='${PWD/#$HOME/~}'
|
||||||
|
local git_info='$(git_prompt_info)'
|
||||||
|
|
||||||
|
|
||||||
|
PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%} ${rvm_ruby} %D - %*
|
||||||
|
╰─$(virtualenv_info)$(prompt_char) "
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔"
|
||||||
|
|
@ -25,7 +25,14 @@ function box_name {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
local rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}'
|
local rvm_ruby=''
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}'
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
rvm_ruby='‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
local current_dir='${PWD/#$HOME/~}'
|
local current_dir='${PWD/#$HOME/~}'
|
||||||
local git_info='$(git_prompt_info)'
|
local git_info='$(git_prompt_info)'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,12 @@ git_custom_status() {
|
||||||
#RVM and git settings
|
#RVM and git settings
|
||||||
if [[ -s ~/.rvm/scripts/rvm ]] ; then
|
if [[ -s ~/.rvm/scripts/rvm ]] ; then
|
||||||
RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1'
|
RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1'
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
RPS1='$(git_custom_status)%{$fg[red]%}[`rbenv version | sed -e "s/ (set.*$//"`]%{$reset_color%} $EPS1'
|
||||||
|
else
|
||||||
|
RPS1='$(git_custom_status) $EPS1'
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
|
PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b '
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
function precmd {
|
function theme_precmd {
|
||||||
local TERMWIDTH
|
local TERMWIDTH
|
||||||
(( TERMWIDTH = ${COLUMNS} - 1 ))
|
(( TERMWIDTH = ${COLUMNS} - 1 ))
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# Truncate the path if it's too long.
|
# Truncate the path if it's too long.
|
||||||
|
|
||||||
PR_FILLBAR=""
|
PR_FILLBAR=""
|
||||||
PR_PWDLEN=""
|
PR_PWDLEN=""
|
||||||
|
|
||||||
local promptsize=${#${(%):---(%n@%m:%l)---()--}}
|
local promptsize=${#${(%):---(%n@%m:%l)---()--}}
|
||||||
local rubyprompt=`rvm_prompt_info`
|
local rubyprompt=`rvm_prompt_info || rbenv_prompt_info`
|
||||||
local rubypromptsize=${#${rubyprompt}}
|
local rubypromptsize=${#${rubyprompt}}
|
||||||
local pwdsize=${#${(%):-%~}}
|
local pwdsize=${#${(%):-%~}}
|
||||||
|
|
||||||
if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then
|
if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then
|
||||||
((PR_PWDLEN=$TERMWIDTH - $promptsize))
|
((PR_PWDLEN=$TERMWIDTH - $promptsize))
|
||||||
else
|
else
|
||||||
|
|
@ -24,7 +24,7 @@ function precmd {
|
||||||
|
|
||||||
|
|
||||||
setopt extended_glob
|
setopt extended_glob
|
||||||
preexec () {
|
theme_preexec () {
|
||||||
if [[ "$TERM" == "screen" ]]; then
|
if [[ "$TERM" == "screen" ]]; then
|
||||||
local CMD=${1[(wr)^(*=*|sudo|-*)]}
|
local CMD=${1[(wr)^(*=*|sudo|-*)]}
|
||||||
echo -n "\ek$CMD\e\\"
|
echo -n "\ek$CMD\e\\"
|
||||||
|
|
@ -69,7 +69,7 @@ setprompt () {
|
||||||
|
|
||||||
###
|
###
|
||||||
# See if we can use extended characters to look nicer.
|
# See if we can use extended characters to look nicer.
|
||||||
|
|
||||||
typeset -A altchar
|
typeset -A altchar
|
||||||
set -A altchar ${(s..)terminfo[acsc]}
|
set -A altchar ${(s..)terminfo[acsc]}
|
||||||
PR_SET_CHARSET="%{$terminfo[enacs]%}"
|
PR_SET_CHARSET="%{$terminfo[enacs]%}"
|
||||||
|
|
@ -81,10 +81,10 @@ setprompt () {
|
||||||
PR_LRCORNER=${altchar[j]:--}
|
PR_LRCORNER=${altchar[j]:--}
|
||||||
PR_URCORNER=${altchar[k]:--}
|
PR_URCORNER=${altchar[k]:--}
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# Decide if we need to set titlebar text.
|
# Decide if we need to set titlebar text.
|
||||||
|
|
||||||
case $TERM in
|
case $TERM in
|
||||||
xterm*)
|
xterm*)
|
||||||
PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
|
PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
|
||||||
|
|
@ -96,8 +96,8 @@ setprompt () {
|
||||||
PR_TITLEBAR=''
|
PR_TITLEBAR=''
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# Decide whether to set a screen title
|
# Decide whether to set a screen title
|
||||||
if [[ "$TERM" == "screen" ]]; then
|
if [[ "$TERM" == "screen" ]]; then
|
||||||
|
|
@ -105,15 +105,15 @@ setprompt () {
|
||||||
else
|
else
|
||||||
PR_STITLE=''
|
PR_STITLE=''
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# Finally, the prompt.
|
# Finally, the prompt.
|
||||||
|
|
||||||
PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
|
PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
|
||||||
$PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
|
$PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
|
||||||
$PR_GREEN%$PR_PWDLEN<...<%~%<<\
|
$PR_GREEN%$PR_PWDLEN<...<%~%<<\
|
||||||
$PR_GREY)`rvm_prompt_info`$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
|
$PR_GREY)`rvm_prompt_info || rbenv_prompt_info`$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
|
||||||
$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\
|
$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\
|
||||||
$PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\
|
$PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\
|
||||||
|
|
||||||
|
|
@ -135,3 +135,7 @@ $PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR '
|
||||||
}
|
}
|
||||||
|
|
||||||
setprompt
|
setprompt
|
||||||
|
|
||||||
|
autoload -U add-zsh-hook
|
||||||
|
add-zsh-hook precmd theme_precmd
|
||||||
|
add-zsh-hook preexec theme_preexec
|
||||||
|
|
@ -10,7 +10,7 @@ function josh_prompt {
|
||||||
prompt=" "
|
prompt=" "
|
||||||
|
|
||||||
branch=$(current_branch)
|
branch=$(current_branch)
|
||||||
ruby_version=$(rvm_prompt_info)
|
ruby_version=$(rvm_prompt_info || rbenv_prompt_info)
|
||||||
path_size=${#PWD}
|
path_size=${#PWD}
|
||||||
branch_size=${#branch}
|
branch_size=${#branch}
|
||||||
ruby_size=${#ruby_version}
|
ruby_size=${#ruby_version}
|
||||||
|
|
@ -31,7 +31,7 @@ function josh_prompt {
|
||||||
prompt=" $prompt"
|
prompt=" $prompt"
|
||||||
done
|
done
|
||||||
|
|
||||||
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $(git_prompt_info)"
|
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(git_prompt_info)"
|
||||||
|
|
||||||
echo $prompt
|
echo $prompt
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ zstyle ':vcs_info:*' unstagedstr '%F{yellow}●'
|
||||||
zstyle ':vcs_info:*' check-for-changes true
|
zstyle ':vcs_info:*' check-for-changes true
|
||||||
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
|
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
|
||||||
zstyle ':vcs_info:*' enable git svn
|
zstyle ':vcs_info:*' enable git svn
|
||||||
precmd () {
|
theme_precmd () {
|
||||||
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
|
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
|
||||||
zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]'
|
zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]'
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -19,3 +19,6 @@ precmd () {
|
||||||
|
|
||||||
setopt prompt_subst
|
setopt prompt_subst
|
||||||
PROMPT='%B%F{magenta}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}%% '
|
PROMPT='%B%F{magenta}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}%% '
|
||||||
|
|
||||||
|
autoload -U add-zsh-hook
|
||||||
|
add-zsh-hook precmd theme_precmd
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
|
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
|
||||||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
|
|
||||||
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
RPS1="${return_code}"
|
RPS1="${return_code}"
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
|
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
|
||||||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
|
|
||||||
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b '
|
||||||
|
fi
|
||||||
|
fi
|
||||||
RPS1="${return_code}"
|
RPS1="${return_code}"
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
|
||||||
|
|
|
||||||
24
themes/mh.zsh-theme
Normal file
24
themes/mh.zsh-theme
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
# mh theme
|
||||||
|
# preview: http://cl.ly/1y2x0W0E3t2C0F29043z
|
||||||
|
|
||||||
|
# features:
|
||||||
|
# path is autoshortened to ~30 characters
|
||||||
|
# displays git status (if applicable in current folder)
|
||||||
|
# turns username green if superuser, otherwise it is white
|
||||||
|
|
||||||
|
# if superuser make the username green
|
||||||
|
if [ $UID -eq 0 ]; then NCOLOR="green"; else NCOLOR="white"; fi
|
||||||
|
|
||||||
|
# prompt
|
||||||
|
PROMPT='[%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[red]%}%30<...<%~%<<%{$reset_color%}]%(!.#.$) '
|
||||||
|
RPROMPT='$(git_prompt_info)'
|
||||||
|
|
||||||
|
# git theming
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[gray]%}(%{$fg_no_bold[yellow]%}%B"
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[gray]%})%{$reset_color%} "
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✱"
|
||||||
|
|
||||||
|
# LS colors, made with http://geoff.greer.fm/lscolors/
|
||||||
|
export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
||||||
|
export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
|
||||||
58
themes/mortalscumbag.zsh-theme
Normal file
58
themes/mortalscumbag.zsh-theme
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
function my_git_prompt() {
|
||||||
|
tester=$(git rev-parse --git-dir 2> /dev/null) || return
|
||||||
|
|
||||||
|
INDEX=$(git status --porcelain 2> /dev/null)
|
||||||
|
STATUS=""
|
||||||
|
|
||||||
|
# is branch ahead?
|
||||||
|
if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||||
|
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# is anything staged?
|
||||||
|
if $(echo "$INDEX" | grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then
|
||||||
|
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# is anything unstaged?
|
||||||
|
if $(echo "$INDEX" | grep -E -e '^[ MARC][MD] ' &> /dev/null); then
|
||||||
|
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# is anything untracked?
|
||||||
|
if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
|
||||||
|
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# is anything unmerged?
|
||||||
|
if $(echo "$INDEX" | grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then
|
||||||
|
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $STATUS ]]; then
|
||||||
|
STATUS=" $STATUS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$ZSH_THEME_GIT_PROMPT_PREFIX$(my_current_branch)$STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||||
|
}
|
||||||
|
|
||||||
|
function my_current_branch() {
|
||||||
|
echo $(current_branch || echo "(no branch)")
|
||||||
|
}
|
||||||
|
|
||||||
|
function ssh_connection() {
|
||||||
|
if [[ -n $SSH_CONNECTION ]]; then
|
||||||
|
echo "%{$fg_bold[red]%}(ssh) "
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n%# '
|
||||||
|
|
||||||
|
ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[magenta]%}↑"
|
||||||
|
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●"
|
||||||
|
ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[red]%}●"
|
||||||
|
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[white]%}●"
|
||||||
|
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[red]%}✕"
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX=" $fg_bold[white]›%{$reset_color%}"
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
|
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
|
||||||
local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}'
|
local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}'
|
||||||
local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info)%{$reset_color%}'
|
local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%}'
|
||||||
local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}'
|
local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}'
|
||||||
|
|
||||||
PROMPT="${user_host}:${current_dir} ${rvm_ruby}
|
PROMPT="${user_host}:${current_dir} ${rvm_ruby}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,10 @@
|
||||||
# Get the current ruby version in use with RVM:
|
# Get the current ruby version in use with RVM:
|
||||||
if [ -e ~/.rvm/bin/rvm-prompt ]; then
|
if [ -e ~/.rvm/bin/rvm-prompt ]; then
|
||||||
RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(~/.rvm/bin/rvm-prompt s i v g)%{$fg_bold[blue]%})%{$reset_color%} "
|
RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(~/.rvm/bin/rvm-prompt s i v g)%{$fg_bold[blue]%})%{$reset_color%} "
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
RUBY_PROMPT_="%{$fg_bold[blue]%}rbenv:(%{$fg[green]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg_bold[blue]%})%{$reset_color%} "
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the host name (first 4 chars)
|
# Get the host name (first 4 chars)
|
||||||
|
|
|
||||||
9
themes/pygmalion.zsh-theme
Normal file
9
themes/pygmalion.zsh-theme
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Yay! High voltage and arrows!
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||||
|
|
||||||
|
PROMPT='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$reset_color%} '
|
||||||
|
|
||||||
6
themes/sammy.zsh-theme
Normal file
6
themes/sammy.zsh-theme
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
PROMPT='%{$fg[white]%}%c$(git_prompt_info)$ % %{$reset_color%}'
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX="("
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="*)"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN=")"
|
||||||
|
|
@ -81,7 +81,7 @@ add-zsh-hook chpwd steeef_chpwd
|
||||||
function steeef_precmd {
|
function steeef_precmd {
|
||||||
if [[ -n "$PR_GIT_UPDATE" ]] ; then
|
if [[ -n "$PR_GIT_UPDATE" ]] ; then
|
||||||
# check for untracked files or updated submodules, since vcs_info doesn't
|
# check for untracked files or updated submodules, since vcs_info doesn't
|
||||||
if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
|
if git ls-files --other --exclude-standard --directory 2> /dev/null | grep -q "."; then
|
||||||
PR_GIT_UPDATE=1
|
PR_GIT_UPDATE=1
|
||||||
FMT_BRANCH="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})"
|
FMT_BRANCH="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,11 @@
|
||||||
# Grab the current version of ruby in use (via RVM): [ruby-1.8.7]
|
# Grab the current version of ruby in use (via RVM): [ruby-1.8.7]
|
||||||
JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}"
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(rbenv version | sed -e 's/ (set.*$//')%{$fg[white]%}]%{$reset_color%}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Grab the current filepath, use shortcuts: ~/Desktop
|
# Grab the current filepath, use shortcuts: ~/Desktop
|
||||||
# Append the current git branch, if in a git repository
|
# Append the current git branch, if in a git repository
|
||||||
|
|
|
||||||
30
themes/suvash.zsh-theme
Normal file
30
themes/suvash.zsh-theme
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
function prompt_char {
|
||||||
|
git branch >/dev/null 2>/dev/null && echo '±' && return
|
||||||
|
hg root >/dev/null 2>/dev/null && echo 'Hg' && return
|
||||||
|
echo '○'
|
||||||
|
}
|
||||||
|
|
||||||
|
function virtualenv_info {
|
||||||
|
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
|
||||||
|
}
|
||||||
|
|
||||||
|
function collapse_pwd {
|
||||||
|
echo $(pwd | sed -e "s,^$HOME,~,")
|
||||||
|
}
|
||||||
|
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%}
|
||||||
|
$(virtualenv_info)$(prompt_char) '
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%}
|
||||||
|
$(virtualenv_info)$(prompt_char) '
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!"
|
||||||
|
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||||
|
|
@ -2,7 +2,7 @@ PROMPT='%{$fg[green]%} %% '
|
||||||
# RPS1='%{$fg[blue]%}%~%{$reset_color%} '
|
# RPS1='%{$fg[blue]%}%~%{$reset_color%} '
|
||||||
RPS1='%{$fg[white]%}%2~$(git_prompt_info) %{$fg_bold[blue]%}%m%{$reset_color%}'
|
RPS1='%{$fg[white]%}%2~$(git_prompt_info) %{$fg_bold[blue]%}%m%{$reset_color%}'
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[yellow]%}"
|
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}("
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
|
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
|
||||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ⚡%{$fg[yellow]%}"
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ⚡%{$fg[yellow]%}"
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}["
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} "
|
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} "
|
||||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} x%{$fg_bold[blue]%}"
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} x%{$fg_bold[blue]%}"
|
||||||
|
|
||||||
PROMPT='%{$(git_prompt_info)%}%{$fg_bold[green]%}{%{$(rvm current)%}}%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} '
|
PROMPT='%{$(git_prompt_info)%}%{$fg_bold[green]%}{%{$(rvm current 2>/dev/null || rbenv version-name 2>/dev/null)%}}%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} '
|
||||||
|
|
|
||||||
15
themes/zhann.zsh-theme
Normal file
15
themes/zhann.zsh-theme
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||||
|
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
RPROMPT='%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v g) %{$reset_color%}'
|
||||||
|
else
|
||||||
|
if which rbenv &> /dev/null; then
|
||||||
|
RPROMPT='%{$reset_color%} %{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//") %{$reset_color%}'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
|
||||||
|
|
@ -8,6 +8,12 @@ function _update_zsh_update() {
|
||||||
echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update
|
echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _upgrade_zsh() {
|
||||||
|
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
|
||||||
|
# update the zsh file
|
||||||
|
_update_zsh_update
|
||||||
|
}
|
||||||
|
|
||||||
if [ -f ~/.zsh-update ]
|
if [ -f ~/.zsh-update ]
|
||||||
then
|
then
|
||||||
. ~/.zsh-update
|
. ~/.zsh-update
|
||||||
|
|
@ -17,19 +23,24 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
|
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
|
||||||
if [ $epoch_diff -gt 6 ]
|
if [ $epoch_diff -gt 13 ]
|
||||||
then
|
then
|
||||||
echo "[Oh My Zsh] Would you like to check for updates?"
|
if [ "$DISABLE_UPDATE_PROMPT" = "true" ]
|
||||||
echo "Type Y to update oh-my-zsh: \c"
|
|
||||||
read line
|
|
||||||
if [ "$line" = Y ] || [ "$line" = y ]
|
|
||||||
then
|
then
|
||||||
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
|
_upgrade_zsh
|
||||||
# update the zsh file
|
else
|
||||||
_update_zsh_update
|
echo "[Oh My Zsh] Would you like to check for updates?"
|
||||||
|
echo "Type Y to update oh-my-zsh: \c"
|
||||||
|
read line
|
||||||
|
if [ "$line" = Y ] || [ "$line" = y ]; then
|
||||||
|
_upgrade_zsh
|
||||||
|
else
|
||||||
|
_update_zsh_update
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# create the zsh file
|
# create the zsh file
|
||||||
_update_zsh_update
|
_update_zsh_update
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,10 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
|
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
|
||||||
/usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
|
hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh || {
|
||||||
|
echo "git not installed"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
echo "\033[0;34mLooking for an existing zsh config...\033[0m"
|
echo "\033[0;34mLooking for an existing zsh config...\033[0m"
|
||||||
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
|
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,19 @@
|
||||||
current_path=`pwd`
|
current_path=`pwd`
|
||||||
echo -e "\033[0;34mUpgrading Oh My Zsh\033[0m"
|
printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh"
|
||||||
( cd $ZSH && git pull origin master )
|
cd $ZSH
|
||||||
echo -e "\033[0;32m"' __ __ '"\033[0m"
|
|
||||||
echo -e "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
|
if git pull origin master
|
||||||
echo -e "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m"
|
then
|
||||||
echo -e "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m"
|
printf '\033[0;32m%s\033[0m\n' ' __ __ '
|
||||||
echo -e "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m"
|
printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
|
||||||
echo -e "\033[0;32m"' /____/ '"\033[0m"
|
printf '\033[0;32m%s\033[0m\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
|
||||||
echo -e "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m"
|
printf '\033[0;32m%s\033[0m\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
|
||||||
echo -e "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m"
|
printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
|
||||||
cd "$current_path"
|
printf '\033[0;32m%s\033[0m\n' ' /____/ '
|
||||||
|
printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.'
|
||||||
|
printf '\033[0;34m%s\033[1m%s\033[0m\n' 'To keep up on the latest, be sure to follow Oh My Zsh on twitter: ' 'http://twitter.com/ohmyzsh'
|
||||||
|
else
|
||||||
|
printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?'
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$current_path"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue