mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-09 02:24:03 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
95d90d3134
55 changed files with 1128 additions and 159 deletions
|
|
@ -8,6 +8,7 @@ alias -- -='cd -'
|
|||
|
||||
# Super user
|
||||
alias _='sudo'
|
||||
alias please='sudo'
|
||||
|
||||
#alias g='grep -in'
|
||||
|
||||
|
|
@ -16,8 +17,9 @@ alias history='fc -l 1'
|
|||
|
||||
# List direcory contents
|
||||
alias lsa='ls -lah'
|
||||
alias l='ls -la'
|
||||
alias l='ls -lA1'
|
||||
alias ll='ls -l'
|
||||
alias la='ls -lA'
|
||||
alias sl=ls # often screw this up
|
||||
|
||||
alias afind='ack-grep -il'
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-dir
|
|||
cdpath=(.)
|
||||
|
||||
# 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 /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _global_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=()
|
||||
hosts=(
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ cd () {
|
|||
elif [[ "x$*" == "x...." ]]; then
|
||||
cd ../../..
|
||||
elif [[ "x$*" == "x....." ]]; then
|
||||
cd ../../..
|
||||
elif [[ "x$*" == "x......" ]]; then
|
||||
cd ../../../..
|
||||
elif [[ "x$*" == "x......" ]]; then
|
||||
cd ../../../../..
|
||||
else
|
||||
builtin cd "$@"
|
||||
fi
|
||||
|
|
@ -37,8 +37,3 @@ cd () {
|
|||
alias md='mkdir -p'
|
||||
alias rd=rmdir
|
||||
alias d='dirs -v | head -10'
|
||||
|
||||
# mkdir & cd to it
|
||||
function mcd() {
|
||||
mkdir -p "$1" && cd "$1";
|
||||
}
|
||||
|
|
|
|||
35
lib/git.zsh
35
lib/git.zsh
|
|
@ -1,6 +1,7 @@
|
|||
# get the name of the branch we are on
|
||||
function git_prompt_info() {
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
}
|
||||
|
||||
|
|
@ -18,6 +19,25 @@ parse_git_dirty() {
|
|||
fi
|
||||
}
|
||||
|
||||
# get the difference between the local and remote branches
|
||||
git_remote_status() {
|
||||
remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
|
||||
if [[ -n ${remote} ]] ; then
|
||||
ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
|
||||
behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
|
||||
|
||||
if [ $ahead -eq 0 ] && [ $behind -gt 0 ]
|
||||
then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
|
||||
elif [ $ahead -gt 0 ] && [ $behind -eq 0 ]
|
||||
then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
|
||||
elif [ $ahead -gt 0 ] && [ $behind -gt 0 ]
|
||||
then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if there are commits ahead from remote
|
||||
function git_prompt_ahead() {
|
||||
|
|
@ -38,7 +58,7 @@ function git_prompt_long_sha() {
|
|||
|
||||
# Get the status of the working tree
|
||||
git_prompt_status() {
|
||||
INDEX=$(git status --porcelain 2> /dev/null)
|
||||
INDEX=$(git status --porcelain -b 2> /dev/null)
|
||||
STATUS=""
|
||||
if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
|
||||
|
|
@ -60,12 +80,23 @@ git_prompt_status() {
|
|||
fi
|
||||
if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
|
||||
elif $(echo "$INDEX" | grep '^D ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
|
||||
elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS"
|
||||
fi
|
||||
if $(echo "$INDEX" | grep '^## .*diverged' &> /dev/null); then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS"
|
||||
fi
|
||||
echo $STATUS
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,5 +9,7 @@ bindkey "^[m" copy-prev-shell-word
|
|||
setopt long_list_jobs
|
||||
|
||||
## pager
|
||||
export PAGER="less -R"
|
||||
export PAGER="less"
|
||||
export LESS="-R"
|
||||
|
||||
export LC_CTYPE=$LANG
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
# get the name of the branch we are on
|
||||
# get the name of the ruby version
|
||||
function rvm_prompt_info() {
|
||||
ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) || return
|
||||
[[ ! -z $ruby_version ]] && echo "($ruby_version)"
|
||||
[ -f $HOME/.rvm/bin/rvm-prompt ] || return
|
||||
local rvm_prompt
|
||||
rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
|
||||
[[ "${rvm_prompt}x" == "x" ]] && return
|
||||
echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ function title {
|
|||
fi
|
||||
if [[ "$TERM" == screen* ]]; then
|
||||
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
|
||||
elif [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
|
||||
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
|
||||
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
print -Pn "\e]2;$2:q\a" #set window name
|
||||
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
|
||||
|
|
@ -26,8 +28,8 @@ function omz_termsupport_precmd {
|
|||
function omz_termsupport_preexec {
|
||||
emulate -L zsh
|
||||
setopt extended_glob
|
||||
local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
|
||||
title "$CMD" "%100>...>$2%<<"
|
||||
local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
|
||||
title "$CMD" "%100>...>${2:gs/%/%%}%<<"
|
||||
}
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
|
|||
|
||||
# Load all of the config files in ~/oh-my-zsh that end in .zsh
|
||||
# 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); do
|
||||
source $config_file
|
||||
done
|
||||
|
||||
# Set ZSH_CUSTOM to the path where your custom config files
|
||||
# and plugins exists, or else we will use the default custom/
|
||||
|
|
@ -51,7 +53,9 @@ for plugin ($plugins); do
|
|||
done
|
||||
|
||||
# Load all of your custom configurations from custom/
|
||||
for config_file ($ZSH_CUSTOM/*.zsh(N)) source $config_file
|
||||
for config_file ($ZSH_CUSTOM/*.zsh(N)); do
|
||||
source $config_file
|
||||
done
|
||||
|
||||
# Load the theme
|
||||
if [ "$ZSH_THEME" = "random" ]
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if [[ -x `which yaourt` ]]; then
|
|||
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 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 yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
|
||||
alias yarep='yaourt -Si' # Display information about a given package in the repositories
|
||||
|
|
@ -35,7 +35,7 @@ fi
|
|||
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
||||
alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
|
||||
alias pacin='sudo pacman -S' # Install specific package(s) from the repositories
|
||||
alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
|
||||
alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
|
||||
alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
|
||||
alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
|
||||
alias pacrep='pacman -Si' # Display information about a given package in the repositories
|
||||
|
|
@ -75,3 +75,19 @@ pacdisowned() {
|
|||
|
||||
comm -23 "$fs" "$db"
|
||||
}
|
||||
|
||||
pacmanallkeys() {
|
||||
# Get all keys for developers and trusted users
|
||||
curl https://www.archlinux.org/{developers,trustedusers}/ |
|
||||
awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' |
|
||||
xargs sudo pacman-key --recv-keys
|
||||
}
|
||||
|
||||
pacmansignkeys() {
|
||||
for key in $*; do
|
||||
sudo pacman-key --recv-keys $key
|
||||
sudo pacman-key --lsign-key $key
|
||||
printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \
|
||||
--no-permission-warning --command-fd 0 --edit-key $key
|
||||
done
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ if [ $commands[autojump] ]; then # check if autojump is installed
|
|||
. /usr/share/autojump/autojump.zsh
|
||||
elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
|
||||
. /etc/profile.d/autojump.zsh
|
||||
elif [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
|
||||
. $HOME/.autojump/etc/profile.d/autojump.zsh
|
||||
elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
|
||||
. /opt/local/etc/profile.d/autojump.zsh
|
||||
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
stat -f%m . > /dev/null 2>&1
|
||||
if [ "$?" = 0 ]; then
|
||||
stat_cmd=(stat -f%m)
|
||||
else
|
||||
stat_cmd=(stat -L --format=%y)
|
||||
fi
|
||||
|
||||
# Cache filename
|
||||
_cap_show_undescribed_tasks=0
|
||||
|
||||
# Cache filename
|
||||
_cap_task_cache_file='.cap_task_cache'
|
||||
|
||||
_cap_get_task_list () {
|
||||
if [ ${_cap_show_undescribed_tasks} -eq 0 ]; then
|
||||
cap -T | grep '^cap' | cut -d " " -f 2
|
||||
else
|
||||
cap -vT | grep '^cap' | cut -d " " -f 2
|
||||
fi
|
||||
}
|
||||
|
||||
_cap_does_task_list_need_generating () {
|
||||
|
||||
if [ ! -f ${_cap_task_cache_file} ]; then return 0;
|
||||
else
|
||||
accurate=$($stat_cmd $_cap_task_cache_file)
|
||||
changed=$($stat_cmd config/deploy.rb)
|
||||
return $(expr $accurate '>=' $changed)
|
||||
fi
|
||||
}
|
||||
|
||||
function _cap () {
|
||||
if [ -f config/deploy.rb ]; then
|
||||
if _cap_does_task_list_need_generating; then
|
||||
_cap_get_task_list > ${_cap_task_cache_file}
|
||||
fi
|
||||
compadd `cat ${_cap_task_cache_file}`
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _cap cap
|
||||
10
plugins/capistrano/_capistrano
Normal file
10
plugins/capistrano/_capistrano
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#compdef cap
|
||||
#autoload
|
||||
|
||||
if [ -f config/deploy.rb ]; then
|
||||
if [[ ! -f .cap_tasks~ || config/deploy.rb -nt .cap_tasks~ ]]; then
|
||||
echo "\nGenerating .cap_tasks~..." > /dev/stderr
|
||||
cap --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~
|
||||
fi
|
||||
compadd `cat .cap_tasks~`
|
||||
fi
|
||||
|
|
@ -2,4 +2,4 @@
|
|||
# as seen in http://www.porcheron.info/command-not-found-for-zsh/
|
||||
# this is installed in Ubuntu
|
||||
|
||||
source /etc/zsh_command_not_found
|
||||
[[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found
|
||||
|
|
|
|||
14
plugins/cp/cp.plugin.zsh
Normal file
14
plugins/cp/cp.plugin.zsh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#Show progress while file is copying
|
||||
|
||||
# Rsync options are:
|
||||
# -p - preserve permissions
|
||||
# -o - preserve owner
|
||||
# -g - preserve group
|
||||
# -h - output in human-readable format
|
||||
# --progress - display progress
|
||||
# -b - instead of just overwriting an existing file, save the original
|
||||
# --backup-dir=/tmp/rsync - move backup copies to "/tmp/rsync"
|
||||
# -e /dev/null - only work on local files
|
||||
# -- - everything after this is an argument, even if it looks like an option
|
||||
|
||||
alias cpv="rsync -poghb --backup-dir=/tmp/rsync -e /dev/null --progress --"
|
||||
|
|
@ -6,14 +6,14 @@
|
|||
|
||||
# Use aptitude if installed, or apt-get if not.
|
||||
# You can just set apt_pref='apt-get' to override it.
|
||||
if [[ -e $( which aptitude ) ]]; then
|
||||
if [[ -e $( which aptitude 2>&1 ) ]]; then
|
||||
apt_pref='aptitude'
|
||||
else
|
||||
apt_pref='apt-get'
|
||||
fi
|
||||
|
||||
# Use sudo by default if it's installed
|
||||
if [[ -e $( which sudo ) ]]; then
|
||||
if [[ -e $( which sudo 2>&1 ) ]]; then
|
||||
use_sudo=1
|
||||
fi
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ fi
|
|||
# These are for more obscure uses of apt-get and aptitude that aren't covered
|
||||
# below.
|
||||
alias ag='apt-get'
|
||||
alias at='aptitude'
|
||||
alias ap='aptitude'
|
||||
|
||||
# Some self-explanatory aliases
|
||||
alias acs="apt-cache search"
|
||||
|
|
@ -35,7 +35,7 @@ alias afs='apt-file search --regexp'
|
|||
|
||||
# These are apt-get only
|
||||
alias asrc='apt-get source'
|
||||
alias ap='apt-cache policy'
|
||||
alias app='apt-cache policy'
|
||||
|
||||
# superuser operations ######################################################
|
||||
if [[ $use_sudo -eq 1 ]]; then
|
||||
|
|
|
|||
44
plugins/forklift/forklift.plugin.zsh
Normal file
44
plugins/forklift/forklift.plugin.zsh
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# Open folder in ForkLift.app from console
|
||||
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
|
||||
#
|
||||
# Usage:
|
||||
# fl [<folder>]
|
||||
#
|
||||
# Opens specified directory or current working directory in ForkLift.app
|
||||
#
|
||||
# Notes:
|
||||
# It assumes Shift+Cmd+G launches go to folder panel and Cmd+N opens new
|
||||
# app window.
|
||||
#
|
||||
# https://gist.github.com/3313481
|
||||
function fl {
|
||||
if [ ! -z "$1" ]; then
|
||||
DIR=$1
|
||||
if [ ! -d "$DIR" ]; then
|
||||
DIR=$(dirname $DIR)
|
||||
fi
|
||||
if [ "$DIR" != "." ]; then
|
||||
PWD=`cd "$DIR";pwd`
|
||||
fi
|
||||
fi
|
||||
osascript 2>&1 1>/dev/null <<END
|
||||
tell application "ForkLift"
|
||||
activate
|
||||
end tell
|
||||
tell application "System Events"
|
||||
tell application process "ForkLift"
|
||||
try
|
||||
set topWindow to window 1
|
||||
on error
|
||||
keystroke "n" using command down
|
||||
set topWindow to window 1
|
||||
end try
|
||||
keystroke "g" using {command down, shift down}
|
||||
tell sheet 1 of topWindow
|
||||
set value of text field 1 to "$PWD"
|
||||
keystroke return
|
||||
end tell
|
||||
end tell
|
||||
end tell
|
||||
END
|
||||
}
|
||||
285
plugins/git-extras/git-extras.plugin.zsh
Normal file
285
plugins/git-extras/git-extras.plugin.zsh
Normal file
|
|
@ -0,0 +1,285 @@
|
|||
#compdef git
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for git-extras (http://github.com/visionmedia/git-extras).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Alexis GRIMALDI (https://github.com/agrimaldi)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Inspirations
|
||||
# -----------
|
||||
#
|
||||
# * git-extras (http://github.com/visionmedia/git-extras)
|
||||
# * git-flow-completion (http://github.com/bobthecow/git-flow-completion)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
__git_command_successful () {
|
||||
if (( ${#pipestatus:#0} > 0 )); then
|
||||
_message 'not a git repository'
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
__git_tag_names() {
|
||||
local expl
|
||||
declare -a tag_names
|
||||
tag_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
|
||||
__git_command_successful || return
|
||||
_wanted tag-names expl tag-name compadd $* - $tag_names
|
||||
}
|
||||
|
||||
|
||||
__git_branch_names() {
|
||||
local expl
|
||||
declare -a branch_names
|
||||
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
|
||||
__git_command_successful || return
|
||||
_wanted branch-names expl branch-name compadd $* - $branch_names
|
||||
}
|
||||
|
||||
|
||||
__git_feature_branch_names() {
|
||||
local expl
|
||||
declare -a branch_names
|
||||
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/feature 2>/dev/null)"}#refs/heads/feature/})
|
||||
__git_command_successful || return
|
||||
_wanted branch-names expl branch-name compadd $* - $branch_names
|
||||
}
|
||||
|
||||
|
||||
__git_refactor_branch_names() {
|
||||
local expl
|
||||
declare -a branch_names
|
||||
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/refactor 2>/dev/null)"}#refs/heads/refactor/})
|
||||
__git_command_successful || return
|
||||
_wanted branch-names expl branch-name compadd $* - $branch_names
|
||||
}
|
||||
|
||||
|
||||
__git_bug_branch_names() {
|
||||
local expl
|
||||
declare -a branch_names
|
||||
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/bug 2>/dev/null)"}#refs/heads/bug/})
|
||||
__git_command_successful || return
|
||||
_wanted branch-names expl branch-name compadd $* - $branch_names
|
||||
}
|
||||
|
||||
|
||||
__git_submodule_names() {
|
||||
local expl
|
||||
declare -a submodule_names
|
||||
submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"})
|
||||
__git_command_successful || return
|
||||
_wanted submodule-names expl submodule-name compadd $* - $submodule_names
|
||||
}
|
||||
|
||||
|
||||
__git_author_names() {
|
||||
local expl
|
||||
declare -a author_names
|
||||
author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"})
|
||||
__git_command_successful || return
|
||||
_wanted author-names expl author-name compadd $* - $author_names
|
||||
}
|
||||
|
||||
|
||||
_git-changelog() {
|
||||
_arguments \
|
||||
'(-l --list)'{-l,--list}'[list commits]' \
|
||||
}
|
||||
|
||||
|
||||
_git-effort() {
|
||||
_arguments \
|
||||
'--above[ignore file with less than x commits]' \
|
||||
}
|
||||
|
||||
|
||||
_git-contrib() {
|
||||
_arguments \
|
||||
':author:__git_author_names'
|
||||
}
|
||||
|
||||
|
||||
_git-count() {
|
||||
_arguments \
|
||||
'--all[detailed commit count]'
|
||||
}
|
||||
|
||||
|
||||
_git-delete-branch() {
|
||||
_arguments \
|
||||
':branch-name:__git_branch_names'
|
||||
}
|
||||
|
||||
|
||||
_git-delete-submodule() {
|
||||
_arguments \
|
||||
':submodule-name:__git_submodule_names'
|
||||
}
|
||||
|
||||
|
||||
_git-delete-tag() {
|
||||
_arguments \
|
||||
':tag-name:__git_tag_names'
|
||||
}
|
||||
|
||||
|
||||
_git-extras() {
|
||||
local curcontext=$curcontext state line ret=1
|
||||
declare -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
': :->command' \
|
||||
'*:: :->option-or-argument' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
declare -a commands
|
||||
commands=(
|
||||
'update:update git-extras'
|
||||
)
|
||||
_describe -t commands command commands && ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
_arguments \
|
||||
'(-v --version)'{-v,--version}'[show current version]' \
|
||||
}
|
||||
|
||||
|
||||
_git-graft() {
|
||||
_arguments \
|
||||
':src-branch-name:__git_branch_names' \
|
||||
':dest-branch-name:__git_branch_names'
|
||||
}
|
||||
|
||||
|
||||
_git-squash() {
|
||||
_arguments \
|
||||
':branch-name:__git_branch_names'
|
||||
}
|
||||
|
||||
|
||||
_git-feature() {
|
||||
local curcontext=$curcontext state line ret=1
|
||||
declare -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
': :->command' \
|
||||
'*:: :->option-or-argument' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
declare -a commands
|
||||
commands=(
|
||||
'finish:merge feature into the current branch'
|
||||
)
|
||||
_describe -t commands command commands && ret=0
|
||||
;;
|
||||
(option-or-argument)
|
||||
curcontext=${curcontext%:*}-$line[1]:
|
||||
case $line[1] in
|
||||
(finish)
|
||||
_arguments -C \
|
||||
':branch-name:__git_feature_branch_names'
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
_git-refactor() {
|
||||
local curcontext=$curcontext state line ret=1
|
||||
declare -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
': :->command' \
|
||||
'*:: :->option-or-argument' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
declare -a commands
|
||||
commands=(
|
||||
'finish:merge refactor into the current branch'
|
||||
)
|
||||
_describe -t commands command commands && ret=0
|
||||
;;
|
||||
(option-or-argument)
|
||||
curcontext=${curcontext%:*}-$line[1]:
|
||||
case $line[1] in
|
||||
(finish)
|
||||
_arguments -C \
|
||||
':branch-name:__git_refactor_branch_names'
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
_git-bug() {
|
||||
local curcontext=$curcontext state line ret=1
|
||||
declare -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
': :->command' \
|
||||
'*:: :->option-or-argument' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
declare -a commands
|
||||
commands=(
|
||||
'finish:merge bug into the current branch'
|
||||
)
|
||||
_describe -t commands command commands && ret=0
|
||||
;;
|
||||
(option-or-argument)
|
||||
curcontext=${curcontext%:*}-$line[1]:
|
||||
case $line[1] in
|
||||
(finish)
|
||||
_arguments -C \
|
||||
':branch-name:__git_bug_branch_names'
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
zstyle ':completion:*:*:git:*' user-commands \
|
||||
changelog:'populate changelog file with commits since the previous tag' \
|
||||
contrib:'display author contributions' \
|
||||
count:'count commits' \
|
||||
delete-branch:'delete local and remote branch' \
|
||||
delete-submodule:'delete submodule' \
|
||||
delete-tag:'delete local and remote tag' \
|
||||
extras:'git-extras' \
|
||||
graft:'merge commits from source branch to destination branch' \
|
||||
squash:'merge commits from source branch into the current one as a single commit' \
|
||||
feature:'create a feature branch' \
|
||||
refactor:'create a refactor branch' \
|
||||
bug:'create a bug branch' \
|
||||
summary:'repository summary' \
|
||||
effort:'display effort statistics' \
|
||||
repl:'read-eval-print-loop' \
|
||||
commits-since:'list commits since a given date' \
|
||||
release:'release commit with the given tag' \
|
||||
alias:'define, search and show aliases' \
|
||||
ignore:'add patterns to .gitignore' \
|
||||
info:'show info about the repository' \
|
||||
create-branch:'create local and remote branch' \
|
||||
fresh-branch:'create empty local branch' \
|
||||
undo:'remove the latest commit' \
|
||||
setup:'setup a git repository' \
|
||||
touch:'one step creation of new files' \
|
||||
obliterate:'Completely remove a file from the repository, including past commits and tags' \
|
||||
local-commits:'list unpushed commits on the local branch' \
|
||||
|
|
@ -221,6 +221,7 @@ __git-flow-feature ()
|
|||
_arguments \
|
||||
-F'[Fetch from origin before performing finish]' \
|
||||
-r'[Rebase instead of merge]'\
|
||||
-k'[Keep branch after performing finish]'\
|
||||
':feature:__git_flow_feature_list'
|
||||
;;
|
||||
|
||||
|
|
|
|||
18
plugins/git-remote-branch/git-remote-branch.plugin.zsh
Normal file
18
plugins/git-remote-branch/git-remote-branch.plugin.zsh
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
_git_remote_branch() {
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null)
|
||||
if [[ -n $ref ]]; then
|
||||
if (( CURRENT == 2 )); then
|
||||
# first arg: operation
|
||||
compadd create publish rename delete track
|
||||
elif (( CURRENT == 3 )); then
|
||||
# second arg: remote branch name
|
||||
compadd `git branch -r | grep -v HEAD | sed "s/.*\///" | sed "s/ //g"`
|
||||
elif (( CURRENT == 4 )); then
|
||||
# third arg: remote name
|
||||
compadd `git remote`
|
||||
fi
|
||||
else;
|
||||
_files
|
||||
fi
|
||||
}
|
||||
compdef _git_remote_branch grb
|
||||
|
|
@ -9,6 +9,7 @@ alias gup='git pull --rebase'
|
|||
compdef _git gup=git-fetch
|
||||
alias gp='git push'
|
||||
compdef _git gp=git-push
|
||||
alias gd='git diff'
|
||||
gdv() { git diff -w "$@" | view - }
|
||||
compdef _git gdv=git-diff
|
||||
alias gc='git commit -v'
|
||||
|
|
@ -24,12 +25,15 @@ alias gba='git branch -a'
|
|||
compdef _git gba=git-branch
|
||||
alias gcount='git shortlog -sn'
|
||||
compdef gcount=git
|
||||
alias gcl='git config --list'
|
||||
alias gcp='git cherry-pick'
|
||||
compdef _git gcp=git-cherry-pick
|
||||
alias glg='git log --stat --max-count=5'
|
||||
compdef _git glg=git-log
|
||||
alias glgg='git log --graph --max-count=5'
|
||||
compdef _git glgg=git-log
|
||||
alias glgga='git log --graph --decorate --all'
|
||||
compdef _git glgga=git-log
|
||||
alias gss='git status -s'
|
||||
compdef _git gss=git-status
|
||||
alias ga='git add'
|
||||
|
|
@ -39,6 +43,8 @@ compdef _git gm=git-merge
|
|||
alias grh='git reset HEAD'
|
||||
alias grhh='git reset HEAD --hard'
|
||||
alias gwc='git whatchanged -p --abbrev-commit --pretty=medium'
|
||||
alias gf='git ls-files | grep'
|
||||
alias gpoat='git push origin --all && git push origin --tags'
|
||||
|
||||
# Will cd into the top of the current repository
|
||||
# or submodule.
|
||||
|
|
@ -55,13 +61,14 @@ alias gsd='git svn dcommit'
|
|||
# Usage example: git pull origin $(current_branch)
|
||||
#
|
||||
function current_branch() {
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||
echo ${ref#refs/heads/}
|
||||
}
|
||||
|
||||
function current_repository() {
|
||||
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||
echo $(git remote -v | cut -d':' -f 2)
|
||||
}
|
||||
|
||||
|
|
|
|||
8
plugins/history/history.plugin.zsh
Normal file
8
plugins/history/history.plugin.zsh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
alias h='history'
|
||||
|
||||
function hs
|
||||
{
|
||||
history | grep $*
|
||||
}
|
||||
|
||||
alias hsi='hs -i'
|
||||
|
|
@ -1,20 +1,36 @@
|
|||
# To use: add a .jira-url file in the base of your project
|
||||
# You can also set JIRA_URL in your .zshrc or put .jira-url in your home directory
|
||||
# .jira-url in the current directory takes precedence
|
||||
#
|
||||
# If you use Rapid Board, set:
|
||||
#JIRA_RAPID_BOARD="yes"
|
||||
# in you .zshrc
|
||||
#
|
||||
# Setup: cd to/my/project
|
||||
# echo "https://name.jira.com" >> .jira-url
|
||||
# Usage: jira # opens a new issue
|
||||
# jira ABC-123 # Opens an existing issue
|
||||
open_jira_issue () {
|
||||
if [ ! -f .jira-url ]; then
|
||||
echo "There is no .jira-url file in the current directory..."
|
||||
return 0;
|
||||
if [ -f .jira-url ]; then
|
||||
jira_url=$(cat .jira-url)
|
||||
elif [ -f ~/.jira-url ]; then
|
||||
jira_url=$(cat ~/.jira-url)
|
||||
elif [[ "x$JIRA_URL" != "x" ]]; then
|
||||
jira_url=$JIRA_URL
|
||||
else
|
||||
jira_url=$(cat .jira-url);
|
||||
if [ -z "$1" ]; then
|
||||
echo "Opening new issue";
|
||||
`open $jira_url/secure/CreateIssue!default.jspa`;
|
||||
echo "JIRA url is not specified anywhere."
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Opening new issue"
|
||||
`open $jira_url/secure/CreateIssue!default.jspa`
|
||||
else
|
||||
echo "Opening issue #$1"
|
||||
if [[ "x$JIRA_RAPID_BOARD" = "yes" ]]; then
|
||||
`open $jira_url/issues/$1`
|
||||
else
|
||||
echo "Opening issue #$1";
|
||||
`open $jira_url/browse/$1`;
|
||||
`open $jira_url/browse/$1`
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
# Flag indicating if we've previously jumped to last directory.
|
||||
typeset -g ZSH_LAST_WORKING_DIRECTORY
|
||||
mkdir -p "$ZSH/cache"
|
||||
local cache_file="$ZSH/cache/last-working-dir"
|
||||
|
||||
# Updates the last directory once directory is changed.
|
||||
|
|
|
|||
|
|
@ -12,3 +12,9 @@ alias hgp='hg push'
|
|||
alias hgs='hg status'
|
||||
# this is the 'git commit --amend' equivalent
|
||||
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
|
||||
|
||||
function hg_current_branch() {
|
||||
if [ -d .hg ]; then
|
||||
echo hg:$(hg branch)
|
||||
fi
|
||||
}
|
||||
|
|
@ -52,8 +52,119 @@ alias mvnt='mvn test'
|
|||
alias mvnag='mvn archetype:generate'
|
||||
|
||||
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`);
|
||||
reply=(
|
||||
# common lifecycle
|
||||
clean process-resources compile process-test-resources test-compile test package verify install deploy site
|
||||
|
||||
# common plugins
|
||||
deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt
|
||||
|
||||
# deploy
|
||||
deploy:deploy-file
|
||||
# failsafe
|
||||
failsafe:integration-test failsafe:verify
|
||||
# install
|
||||
install:install-file
|
||||
# site
|
||||
site:site site:deploy site:run site:stage site:stage-deploy
|
||||
# surefire
|
||||
surefire:test
|
||||
|
||||
# checkstyle
|
||||
checkstyle:checkstyle checkstyle:check
|
||||
# javadoc
|
||||
javadoc:javadoc javadoc:jar javadoc:aggregate
|
||||
# jxr
|
||||
jxr:jxr
|
||||
# pmd
|
||||
pmd:pmd pmd:cpd pmd:check pmd:cpd-check
|
||||
|
||||
# ant
|
||||
ant:ant ant:clean
|
||||
# antrun
|
||||
antrun:run
|
||||
# archetype
|
||||
archetype:generate archetype:create-from-project archetype:crawl
|
||||
# assembly
|
||||
assembly:single assembly:assembly
|
||||
# dependency
|
||||
dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:get dependency:go-offline dependency:list dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies
|
||||
# enforcer
|
||||
enforcer:enforce
|
||||
# gpg
|
||||
gpg:sign gpg:sign-and-deploy-file
|
||||
# help
|
||||
help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system
|
||||
# release
|
||||
release:clean release:prepare release:rollback release:perform release:stage release:branch release:update-versions
|
||||
# repository
|
||||
repository:bundle-create repository:bundle-pack
|
||||
# source
|
||||
source:aggregate source:jar source:jar-no-fork
|
||||
|
||||
# eclipse
|
||||
eclipse:clean eclipse:eclipse
|
||||
# idea
|
||||
idea:clean idea:idea
|
||||
|
||||
# jetty
|
||||
jetty:run jetty:run-exploded
|
||||
# cargo
|
||||
cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help
|
||||
# jboss
|
||||
jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy
|
||||
# tomcat
|
||||
tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:undeploy
|
||||
# tomcat6
|
||||
tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy
|
||||
# tomcat7
|
||||
tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy
|
||||
# exec
|
||||
exec:exec exec:java
|
||||
# versions
|
||||
versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert
|
||||
# scm
|
||||
scm:add scm:checkin scm:checkout scm:update scm:status
|
||||
# buildnumber
|
||||
buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset
|
||||
|
||||
# war
|
||||
war:war war:exploded war:inplace war:manifest
|
||||
# ear
|
||||
ear:ear ear:generate-application-xml
|
||||
# ejb
|
||||
ejb:ejb
|
||||
# android
|
||||
android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices
|
||||
# nexus
|
||||
nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download
|
||||
# repository
|
||||
repository:bundle-create repository:bundle-pack repository:help
|
||||
|
||||
# sonar
|
||||
sonar:sonar
|
||||
# license
|
||||
license:format license:check
|
||||
# hibernate3
|
||||
hibernate3:hbm2ddl hibernate3:help
|
||||
# liquibase
|
||||
liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback
|
||||
# flyway
|
||||
flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate
|
||||
# gwt
|
||||
gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test
|
||||
|
||||
# options
|
||||
-Dmaven.test.skip=true -DskipTests -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven
|
||||
|
||||
# arguments
|
||||
-am -amd -B -C -c -cpu -D -e -emp -ep -f -fae -ff -fn -gs -h -l -N -npr -npu -nsu -o -P -pl -q -rf -s -T -t -U -up -V -v -X
|
||||
|
||||
cli:execute cli:execute-phase
|
||||
archetype:generate generate-sources
|
||||
cobertura:cobertura
|
||||
-Dtest= `if [ -d ./src ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`
|
||||
);
|
||||
}
|
||||
|
||||
compctl -K listMavenCompletions mvn
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Open the node api for your current version to the optional section.
|
||||
# TODO: Make the section part easier to use.
|
||||
function node-docs {
|
||||
open "http://nodejs.org/docs/$(node --version)/api/all.html#$1"
|
||||
open "http://nodejs.org/docs/$(node --version)/api/all.html#all_$1"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@
|
|||
# FILE: osx.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh plugin file.
|
||||
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com)
|
||||
# VERSION: 1.0.1
|
||||
# VERSION: 1.1.0
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
function tab() {
|
||||
local command="cd \\\"$PWD\\\""
|
||||
(( $# > 0 )) && command="${command}; $*"
|
||||
|
|
@ -35,7 +34,7 @@ EOF
|
|||
launch session "Default Session"
|
||||
set current_session to current session
|
||||
tell current_session
|
||||
write text "${command}"
|
||||
write text "${command}; clear;"
|
||||
end tell
|
||||
end tell
|
||||
end tell
|
||||
|
|
@ -43,6 +42,64 @@ EOF
|
|||
}
|
||||
}
|
||||
|
||||
function vsplit_tab() {
|
||||
local command="cd \\\"$PWD\\\""
|
||||
(( $# > 0 )) && command="${command}; $*"
|
||||
|
||||
the_app=$(
|
||||
osascript 2>/dev/null <<EOF
|
||||
tell application "System Events"
|
||||
name of first item of (every process whose frontmost is true)
|
||||
end tell
|
||||
EOF
|
||||
)
|
||||
|
||||
[[ "$the_app" == 'iTerm' ]] && {
|
||||
osascript 2>/dev/null <<EOF
|
||||
tell application "iTerm" to activate
|
||||
|
||||
tell application "System Events"
|
||||
tell process "iTerm"
|
||||
tell menu item "Split Vertically With Current Profile" of menu "Shell" of menu bar item "Shell" of menu bar 1
|
||||
click
|
||||
end tell
|
||||
end tell
|
||||
keystroke "${command}; clear;"
|
||||
keystroke return
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
}
|
||||
|
||||
function split_tab() {
|
||||
local command="cd \\\"$PWD\\\""
|
||||
(( $# > 0 )) && command="${command}; $*"
|
||||
|
||||
the_app=$(
|
||||
osascript 2>/dev/null <<EOF
|
||||
tell application "System Events"
|
||||
name of first item of (every process whose frontmost is true)
|
||||
end tell
|
||||
EOF
|
||||
)
|
||||
|
||||
[[ "$the_app" == 'iTerm' ]] && {
|
||||
osascript 2>/dev/null <<EOF
|
||||
tell application "iTerm" to activate
|
||||
|
||||
tell application "System Events"
|
||||
tell process "iTerm"
|
||||
tell menu item "Split Horizontally With Current Profile" of menu "Shell" of menu bar item "Shell" of menu bar 1
|
||||
click
|
||||
end tell
|
||||
end tell
|
||||
keystroke "${command}; clear;"
|
||||
keystroke return
|
||||
end tell
|
||||
EOF
|
||||
}
|
||||
}
|
||||
|
||||
function pfd() {
|
||||
osascript 2>/dev/null <<EOF
|
||||
tell application "Finder"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
# Find python file
|
||||
alias pyfind='find . -name "*.py"'
|
||||
|
||||
# Remove python compiled byte-code
|
||||
alias pyclean='find . -type f -name "*.py[co]" -delete'
|
||||
# Remove python compiled byte-code in either current directory or in a
|
||||
# list of specified directories
|
||||
function pyclean() {
|
||||
ZSH_PYCLEAN_PLACES=${*:-'.'}
|
||||
find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete
|
||||
}
|
||||
|
||||
# Grep among .py files
|
||||
alias pygrep='grep --include="*.py"'
|
||||
|
|
|
|||
4
plugins/rsync/rsync.plugin.zsh
Normal file
4
plugins/rsync/rsync.plugin.zsh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
alias rsync-copy="rsync -av --progress -h"
|
||||
alias rsync-move="rsync -av --progress -h --remove-source-files"
|
||||
alias rsync-update="rsync -avu --progress -h"
|
||||
alias rsync-synchronize="rsync -avu --delete --progress -h"
|
||||
|
|
@ -4,7 +4,7 @@ alias rubies='rvm list rubies'
|
|||
alias gemsets='rvm gemset list'
|
||||
|
||||
local ruby18='ruby-1.8.7-p334'
|
||||
local ruby19='ruby-1.9.2-p180'
|
||||
local ruby19='ruby-1.9.3-p194'
|
||||
|
||||
function rb18 {
|
||||
if [ -z "$1" ]; then
|
||||
|
|
@ -44,3 +44,8 @@ function gems {
|
|||
-Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \
|
||||
-Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g"
|
||||
}
|
||||
|
||||
function _rvm_completion {
|
||||
source $rvm_path"/scripts/zsh/Completion/_rvm"
|
||||
}
|
||||
compdef _rvm_completion rvm
|
||||
|
|
|
|||
|
|
@ -1,13 +1,21 @@
|
|||
# Sublime Text 2 Aliases
|
||||
#unamestr = 'uname'
|
||||
|
||||
local _sublime_darwin_subl=/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
|
||||
|
||||
if [[ $('uname') == 'Linux' ]]; then
|
||||
if [ -f '/usr/bin/sublime_text' ]; then
|
||||
alias st='/usr/bin/sublime_text&'
|
||||
st_run() { nohup /usr/bin/sublime_text $@ > /dev/null & }
|
||||
else
|
||||
alias st='/usr/bin/sublime-text&'
|
||||
st_run() { nohup /usr/bin/sublime-text $@ > /dev/null & }
|
||||
fi
|
||||
alias st=st_run
|
||||
elif [[ $('uname') == 'Darwin' ]]; then
|
||||
alias st='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl'
|
||||
# Check if Sublime is installed in user's home application directory
|
||||
if [[ -a $HOME/${_sublime_darwin_subl} ]]; then
|
||||
alias st='$HOME/${_sublime_darwin_subl}'
|
||||
else
|
||||
alias st='${_sublime_darwin_subl}'
|
||||
fi
|
||||
fi
|
||||
alias stt='st .'
|
||||
|
|
|
|||
13
plugins/symfony/symfony.plugin.zsh
Normal file
13
plugins/symfony/symfony.plugin.zsh
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# symfony basic command completion
|
||||
|
||||
_symfony_get_command_list () {
|
||||
./symfony | sed "1,/Available tasks/d" | awk 'BEGIN { cat=null; } /^[A-Za-z]+$/ { cat = $1; } /^ :[a-z]+/ { print cat $1; }'
|
||||
}
|
||||
|
||||
_symfony () {
|
||||
if [ -f symfony ]; then
|
||||
compadd `_symfony_get_command_list`
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _symfony symfony
|
||||
|
|
@ -11,7 +11,9 @@ _symfony2 () {
|
|||
}
|
||||
|
||||
compdef _symfony2 app/console
|
||||
compdef _symfony2 sf
|
||||
|
||||
#Alias
|
||||
alias sf2='php app/console'
|
||||
alias sf2clear='php app/console cache:clear'
|
||||
alias sf2clear='php app/console cache:clear'
|
||||
|
||||
|
|
|
|||
11
plugins/systemd/systemd.plugin.zsh
Normal file
11
plugins/systemd/systemd.plugin.zsh
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
user_commands=(
|
||||
list-units is-active status show help list-unit-files
|
||||
is-enabled list-jobs show-environment)
|
||||
|
||||
sudo_commands=(
|
||||
start stop reload restart try-restart isolate kill
|
||||
reset-failed enable disable reenable preset mask unmask
|
||||
link load cancel set-environment unset-environment)
|
||||
|
||||
for c in $user_commands; do; alias sc-$c="systemctl $c"; done
|
||||
for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done
|
||||
|
|
@ -1,11 +1,39 @@
|
|||
# Set Apple Terminal.app resume directory
|
||||
# based on this answer: http://superuser.com/a/315029
|
||||
# 2012-10-26: (javageek) Changed code using the updated answer
|
||||
|
||||
function chpwd {
|
||||
local SEARCH=' '
|
||||
local REPLACE='%20'
|
||||
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
|
||||
printf '\e]7;%s\a' "$PWD_URL"
|
||||
}
|
||||
# Tell the terminal about the working directory whenever it changes.
|
||||
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
|
||||
update_terminal_cwd() {
|
||||
# Identify the directory using a "file:" scheme URL, including
|
||||
# the host name to disambiguate local vs. remote paths.
|
||||
|
||||
chpwd
|
||||
# Percent-encode the pathname.
|
||||
local URL_PATH=''
|
||||
{
|
||||
# Use LANG=C to process text byte-by-byte.
|
||||
local i ch hexch LANG=C
|
||||
for ((i = 1; i <= ${#PWD}; ++i)); do
|
||||
ch="$PWD[i]"
|
||||
if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then
|
||||
URL_PATH+="$ch"
|
||||
else
|
||||
hexch=$(printf "%02X" "'$ch")
|
||||
URL_PATH+="%$hexch"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
local PWD_URL="file://$HOST$URL_PATH"
|
||||
#echo "$PWD_URL" # testing
|
||||
printf '\e]7;%s\a' "$PWD_URL"
|
||||
}
|
||||
|
||||
# Register the function so it is called whenever the working
|
||||
# directory changes.
|
||||
autoload add-zsh-hook
|
||||
add-zsh-hook chpwd update_terminal_cwd
|
||||
|
||||
# Tell the terminal about the initial directory.
|
||||
update_terminal_cwd
|
||||
fi
|
||||
|
|
|
|||
3
plugins/themes/_theme
Normal file
3
plugins/themes/_theme
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#compdef theme
|
||||
|
||||
_arguments "1: :($(lstheme | tr "\n" " "))"
|
||||
24
plugins/themes/themes.plugin.zsh
Normal file
24
plugins/themes/themes.plugin.zsh
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
function theme
|
||||
{
|
||||
if [ "$1" = "random" ]; then
|
||||
themes=($ZSH/themes/*zsh-theme)
|
||||
N=${#themes[@]}
|
||||
((N=(RANDOM%N)+1))
|
||||
RANDOM_THEME=${themes[$N]}
|
||||
source "$RANDOM_THEME"
|
||||
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
|
||||
else
|
||||
if [ -f "$ZSH_CUSTOM/$1.zsh-theme" ]
|
||||
then
|
||||
source "$ZSH_CUSTOM/$1.zsh-theme"
|
||||
else
|
||||
source "$ZSH/themes/$1.zsh-theme"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function lstheme
|
||||
{
|
||||
cd $ZSH/themes
|
||||
ls *zsh-theme | sed 's,\.zsh-theme$,,'
|
||||
}
|
||||
|
|
@ -4,6 +4,33 @@
|
|||
# Taken from:
|
||||
# http://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/
|
||||
|
||||
alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"'
|
||||
if [[ $(whence $URLTOOLS_METHOD) = "" ]]; then
|
||||
URLTOOLS_METHOD=""
|
||||
fi
|
||||
|
||||
alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"'
|
||||
if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xnode" ) ]]; then
|
||||
alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"'
|
||||
alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"'
|
||||
elif [[ $(whence python) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
|
||||
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
|
||||
alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
|
||||
elif [[ $(whence ruby) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xruby" ) ]]; then
|
||||
alias urlencode='ruby -r cgi -e "puts CGI.escape(ARGV[0])"'
|
||||
alias urldecode='ruby -r cgi -e "puts CGI.unescape(ARGV[0])"'
|
||||
elif [[ $(whence php) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xphp" ) ]]; then
|
||||
alias urlencode='php -r "echo rawurlencode(\$argv[1]); echo \"\n\";"'
|
||||
alias urldecode='php -r "echo rawurldecode(\$argv[1]); echo \"\\n\";"'
|
||||
elif [[ $(whence perl) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xperl" ) ]]; then
|
||||
if perl -MURI::Encode -e 1&> /dev/null; then
|
||||
alias urlencode='perl -MURI::Encode -ep "uri_encode($ARGV[0]);"'
|
||||
alias urldecode='perl -MURI::Encode -ep "uri_decode($ARGV[0]);"'
|
||||
elif perl -MURI::Escape -e 1 &> /dev/null; then
|
||||
alias urlencode='perl -MURI::Escape -ep "uri_escape($ARGV[0]);"'
|
||||
alias urldecode='perl -MURI::Escape -ep "uri_unescape($ARGV[0]);"'
|
||||
else
|
||||
alias urlencode="perl -e '\$new=\$ARGV[0]; \$new =~ s/([^A-Za-z0-9])/sprintf(\"%%%02X\", ord(\$1))/seg; print \"\$new\n\";'"
|
||||
alias urldecode="perl -e '\$new=\$ARGV[0]; \$new =~ s/\%([A-Fa-f0-9]{2})/pack(\"C\", hex(\$1))/seg; print \"\$new\n\";'"
|
||||
fi
|
||||
fi
|
||||
|
||||
unset URLTOOLS_METHOD
|
||||
|
|
@ -46,6 +46,11 @@ __box_list ()
|
|||
_wanted application expl 'command' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g')
|
||||
}
|
||||
|
||||
__vm_list ()
|
||||
{
|
||||
_wanted application expl 'command' compadd $(command grep Vagrantfile -oe '^[^#]*\.vm\.define *:\([a-zA-Z0-9]\+\)' 2>/dev/null | cut -d: -f2)
|
||||
}
|
||||
|
||||
__vagrant-box ()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
|
|
@ -99,6 +104,8 @@ case $state in
|
|||
(box)
|
||||
__vagrant-box
|
||||
;;
|
||||
(up|provision|package|destroy|reload|ssh|halt|resume|status)
|
||||
_arguments ':feature:__vm_list'
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -1,8 +1,26 @@
|
|||
function zle-line-init zle-keymap-select {
|
||||
# Ensures that $terminfo values are valid and updates editor information when
|
||||
# the keymap changes.
|
||||
function zle-keymap-select zle-line-init zle-line-finish {
|
||||
# The terminal must be in application mode when ZLE is active for $terminfo
|
||||
# values to be valid.
|
||||
if (( $+terminfo[smkx] && $+terminfo[rmkx] )); then
|
||||
case "$0" in
|
||||
(zle-line-init)
|
||||
# Enable terminal application mode.
|
||||
echoti smkx
|
||||
;;
|
||||
(zle-line-finish)
|
||||
# Disable terminal application mode.
|
||||
echoti rmkx
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
zle reset-prompt
|
||||
zle -R
|
||||
}
|
||||
|
||||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
zle -N zle-keymap-select
|
||||
|
||||
bindkey -v
|
||||
|
|
|
|||
|
|
@ -1,46 +1,40 @@
|
|||
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
|
||||
wrapsource=`which virtualenvwrapper_lazy.sh`
|
||||
|
||||
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
|
||||
}
|
||||
if [[ -f "$wrapsource" ]]; then
|
||||
source $wrapsource
|
||||
|
||||
# New cd function that does the virtualenv magic
|
||||
function cd {
|
||||
builtin cd "$@" && workon_cwd
|
||||
}
|
||||
fi
|
||||
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
|
||||
}
|
||||
|
||||
break
|
||||
# New cd function that does the virtualenv magic
|
||||
function cd {
|
||||
builtin cd "$@" && workon_cwd
|
||||
}
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $WRAPPER_FOUND -eq 0 ] ; then
|
||||
print "zsh virtualenvwrapper plugin: Couldn't activate virtualenvwrapper. Please run \`pip install virtualenvwrapper\`."
|
||||
else
|
||||
print "zsh virtualenvwrapper plugin: Cannot find virtualenvwrapper_lazy.sh. Please install with \`pip install virtualenvwrapper\`."
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ ZSH_THEME="robbyrussell"
|
|||
# Set to this to use case-sensitive completion
|
||||
# CASE_SENSITIVE="true"
|
||||
|
||||
# Comment this out to disable weekly auto-update checks
|
||||
# Comment this out to disable bi-weekly auto-update checks
|
||||
# DISABLE_AUTO_UPDATE="true"
|
||||
|
||||
# Change this value to set how frequently ZSH updates¬
|
||||
export UPDATE_ZSH_DAYS=13
|
||||
# Uncomment to change how many often would you like to wait before auto-updates occur? (in days)
|
||||
# export UPDATE_ZSH_DAYS=13
|
||||
|
||||
# Uncomment following line if you want to disable colors in ls
|
||||
# DISABLE_LS_COLORS="true"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
PROMPT='%{$fg_bold[cyan]%}☁ %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[cyan]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
if [[ -z $ZSH_THEME_CLOUD_PREFIX ]]; then
|
||||
ZSH_THEME_CLOUD_PREFIX='☁'
|
||||
fi
|
||||
|
||||
PROMPT='%{$fg_bold[cyan]%}$ZSH_THEME_CLOUD_PREFIX %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[cyan]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ function virtualenv_info {
|
|||
}
|
||||
|
||||
function prompt_char {
|
||||
git branch >/dev/null 2>/dev/null && echo '±' && return
|
||||
git branch >/dev/null 2>/dev/null && echo '⠠⠵' && return
|
||||
echo '○'
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
# ZSH Theme emulating the Fish shell's default prompt.
|
||||
|
||||
_fishy_collapsed_wd() {
|
||||
echo $(pwd | perl -pe "s|^$HOME|~|g; s|/([^/])[^/]*(?=/)|/\$1|g")
|
||||
}
|
||||
|
||||
local user_color='green'; [ $UID -eq 0 ] && user_color='red'
|
||||
PROMPT='%n@%m %{$fg[$user_color]%}%~%{$reset_color%}%(!.#.>) '
|
||||
PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) '
|
||||
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
|
||||
|
||||
local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%#%{$reset_color%} '
|
||||
function prompt_char {
|
||||
if [ $UID -eq 0 ]; then echo "#"; else echo $; fi
|
||||
}
|
||||
|
||||
PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%_$(prompt_char)%{$reset_color%} '
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=") "
|
||||
|
|
|
|||
24
themes/intheloop.zsh-theme
Normal file
24
themes/intheloop.zsh-theme
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# ZSH theme by James Smith (http://loopj.com)
|
||||
# A multiline prompt with username, hostname, full path, return status, git branch, git dirty status, git remote status
|
||||
|
||||
local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}"
|
||||
|
||||
local host_color="green"
|
||||
if [ -n "$SSH_CLIENT" ]; then
|
||||
local host_color="red"
|
||||
fi
|
||||
|
||||
PROMPT='
|
||||
%{$fg_bold[grey]%}[%{$reset_color%}%{$fg_bold[${host_color}]%}%n@%m%{$reset_color%}%{$fg_bold[grey]%}]%{$reset_color%} %{$fg_bold[blue]%}%10c%{$reset_color%} $(git_prompt_info) $(git_remote_status)
|
||||
%{$fg_bold[cyan]%}❯%{$reset_color%} '
|
||||
|
||||
|
||||
RPROMPT='${return_status}%{$reset_color%}'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[grey]%}(%{$fg[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[grey]%}) %{$fg[yellow]%}⚡%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[grey]%})"
|
||||
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="%{$fg_bold[magenta]%}↓%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE="%{$fg_bold[magenta]%}↑%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="%{$fg_bold[magenta]%}↕%{$reset_color%}"
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
functions rbenv_prompt_info >& /dev/null || rbenv_prompt_info(){}
|
||||
|
||||
function theme_precmd {
|
||||
local TERMWIDTH
|
||||
(( TERMWIDTH = ${COLUMNS} - 1 ))
|
||||
|
|
|
|||
34
themes/junkfood.zsh-theme
Normal file
34
themes/junkfood.zsh-theme
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# ------------------------------------------------------------------------
|
||||
# Tyler Cipriani
|
||||
# oh-my-zsh theme
|
||||
# Totally ripped off Dallas theme
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
# Grab the current date (%W) and time (%t):
|
||||
JUNKFOOD_TIME_="%{$fg_bold[red]%}#%{$fg_bold[white]%}( %{$fg_bold[yellow]%}%W%{$reset_color%}@%{$fg_bold[white]%}%t )( %{$reset_color%}"
|
||||
|
||||
# Grab the current machine name
|
||||
JUNKFOOD_MACHINE_="%{$fg_bold[blue]%}%m%{$fg[white]%} ):%{$reset_color%}"
|
||||
|
||||
# Grab the current username
|
||||
JUNKFOOD_CURRENT_USER_="%{$fg_bold[green]%}%n%{$reset_color%}"
|
||||
|
||||
# Grab the current filepath, use shortcuts: ~/Desktop
|
||||
# Append the current git branch, if in a git repository: ~aw@master
|
||||
JUNKFOOD_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}"
|
||||
|
||||
# For the git prompt, use a white @ and blue text for the branch name
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}@%{$fg_bold[white]%}"
|
||||
|
||||
# Close it all off by resetting the color and styles.
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
|
||||
# Do nothing if the branch is clean (no changes).
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✔"
|
||||
|
||||
# Add 3 cyan ✗s if this branch is diiirrrty! Dirty branch!
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✗✗✗"
|
||||
|
||||
# Put it all together!
|
||||
PROMPT="$JUNKFOOD_TIME_$JUNKFOOD_CURRENT_USER_@$JUNKFOOD_MACHINE_$JUNKFOOD_LOCA_
|
||||
"
|
||||
6
themes/kafeitu.zsh-theme
Normal file
6
themes/kafeitu.zsh-theme
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n%{$fg[cyan]%}@%{$fg_bold[green]%}%m %{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$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]%})"
|
||||
|
|
@ -46,7 +46,8 @@ function ssh_connection() {
|
|||
fi
|
||||
}
|
||||
|
||||
PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n%# '
|
||||
local ret_status="%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%})%?%{$reset_color%}"
|
||||
PROMPT=$'\n$(ssh_connection)%{$fg_bold[green]%}%n@%m%{$reset_color%}$(my_git_prompt) : %~\n[${ret_status}] %# '
|
||||
|
||||
ZSH_THEME_PROMPT_RETURNCODE_PREFIX="%{$fg_bold[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" $fg[white]‹ %{$fg_bold[yellow]%}"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
PROMPT='%{$fg[yellow]%}λ %{$fg[green]%}%c %{$fg[yellow]%}→ $(git_prompt_info)%{$reset_color%}'
|
||||
PROMPT='%{$fg[yellow]%}λ %m %{$fg[green]%}%c %{$fg[yellow]%}→ $(git_prompt_info)%{$reset_color%}'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="λ %{$fg[blue]%}git %{$fg[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%} → %{$reset_color%}"
|
||||
|
|
|
|||
141
themes/simonoff.zsh-theme
Normal file
141
themes/simonoff.zsh-theme
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
# Prompt
|
||||
#
|
||||
# Below are the color init strings for the basic file types. A color init
|
||||
# string consists of one or more of the following numeric codes:
|
||||
# Attribute codes:
|
||||
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
|
||||
# Text color codes:
|
||||
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
|
||||
# Background color codes:
|
||||
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
|
||||
function precmd {
|
||||
|
||||
local TERMWIDTH
|
||||
(( TERMWIDTH = ${COLUMNS} - 1 ))
|
||||
|
||||
|
||||
###
|
||||
# Truncate the path if it's too long.
|
||||
|
||||
PR_FILLBAR=""
|
||||
PR_PWDLEN=""
|
||||
|
||||
local promptsize=${#${(%):---(%n@%M:%l)---()}}
|
||||
local pwdsize=${#${(%):-%~}}
|
||||
local gitbranch="$(git_prompt_info)"
|
||||
local rvmprompt="$(rvm_prompt_info)"
|
||||
local gitbranchsize=${#${gitbranch:-''}}
|
||||
local rvmpromptsize=${#${rvmprompt:-''}}
|
||||
|
||||
if [[ "$promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize" -gt $TERMWIDTH ]]; then
|
||||
((PR_PWDLEN=$TERMWIDTH - $promptsize))
|
||||
else
|
||||
PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize)))..${PR_SPACE}.)}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
setopt extended_glob
|
||||
|
||||
preexec () {
|
||||
if [[ "$TERM" == "screen" ]]; then
|
||||
local CMD=${1[(wr)^(*=*|sudo|-*)]}
|
||||
echo -n "\ek$CMD\e\\"
|
||||
fi
|
||||
|
||||
if [[ "$TERM" == "xterm" ]]; then
|
||||
print -Pn "\e]0;$1\a"
|
||||
fi
|
||||
|
||||
if [[ "$TERM" == "rxvt" ]]; then
|
||||
print -Pn "\e]0;$1\a"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
setprompt () {
|
||||
###
|
||||
# Need this so the prompt will work.
|
||||
|
||||
setopt prompt_subst
|
||||
|
||||
|
||||
###
|
||||
# See if we can use colors.
|
||||
|
||||
autoload colors zsh/terminfo
|
||||
if [[ "$terminfo[colors]" -ge 8 ]]; then
|
||||
colors
|
||||
fi
|
||||
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
|
||||
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
|
||||
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
|
||||
(( count = $count + 1 ))
|
||||
done
|
||||
PR_NO_COLOUR="%{$terminfo[sgr0]%}"
|
||||
|
||||
|
||||
###
|
||||
# See if we can use extended characters to look nicer.
|
||||
|
||||
typeset -A altchar
|
||||
# set -A altchar "${(s..)terminfo[acsc]}"
|
||||
PR_SET_CHARSET="%{$terminfo[enacs]%}"
|
||||
PR_HBAR=${altchar[q]:--}
|
||||
PR_ULCORNER=${altchar[l]:--}
|
||||
PR_LLCORNER=${altchar[m]:--}
|
||||
PR_LRCORNER=${altchar[j]:--}
|
||||
PR_URCORNER=${altchar[k]:--}
|
||||
|
||||
###
|
||||
# Modify Git prompt
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" ["
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="]"
|
||||
###
|
||||
# Modify RVM prompt
|
||||
ZSH_THEME_RVM_PROMPT_PREFIX=" ["
|
||||
ZSH_THEME_RVM_PROMPT_SUFFIX="]"
|
||||
|
||||
|
||||
###
|
||||
# Decide if we need to set titlebar text.
|
||||
|
||||
case $TERM in
|
||||
xterm*|*rxvt*)
|
||||
PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%M:%~ $(git_prompt_info) $(rvm_prompt_info) | ${COLUMNS}x${LINES} | %y\a%}'
|
||||
;;
|
||||
screen)
|
||||
PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}'
|
||||
;;
|
||||
*)
|
||||
PR_TITLEBAR=''
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
###
|
||||
# Decide whether to set a screen title
|
||||
if [[ "$TERM" == "screen" ]]; then
|
||||
PR_STITLE=$'%{\ekzsh\e\\%}'
|
||||
else
|
||||
PR_STITLE=''
|
||||
fi
|
||||
|
||||
###
|
||||
# Finally, the prompt.
|
||||
#
|
||||
PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
|
||||
$PR_RED$PR_HBAR<\
|
||||
$PR_BLUE%(!.$PR_RED%SROOT%s.%n)$PR_GREEN@$PR_BLUE%M:$PR_GREEN%$PR_PWDLEN<...<%~$PR_CYAN$(git_prompt_info)$(rvm_prompt_info)\
|
||||
$PR_RED>$PR_HBAR$PR_SPACE${(e)PR_FILLBAR}\
|
||||
$PR_RED$PR_HBAR<\
|
||||
$PR_GREEN%l$PR_RED>$PR_HBAR\
|
||||
|
||||
$PR_RED$PR_HBAR<\
|
||||
%(?..$PR_LIGHT_RED%?$PR_BLUE:)\
|
||||
$PR_LIGHT_BLUE%(!.$PR_RED.$PR_WHITE)%#$PR_RED>$PR_HBAR\
|
||||
$PR_NO_COLOUR '
|
||||
|
||||
}
|
||||
|
||||
setprompt
|
||||
|
|
@ -14,8 +14,7 @@ echo "\033[0;34mLooking for an existing zsh config...\033[0m"
|
|||
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
|
||||
then
|
||||
echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-oh-my-zsh\033[0m";
|
||||
cp ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
|
||||
rm ~/.zshrc;
|
||||
mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
|
||||
fi
|
||||
|
||||
echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
|
||||
|
|
|
|||
|
|
@ -4,12 +4,20 @@ then
|
|||
rm -rf ~/.oh-my-zsh
|
||||
fi
|
||||
|
||||
echo "Looking for an existing zsh config..."
|
||||
echo "Looking for original zsh config..."
|
||||
if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]
|
||||
then
|
||||
echo "Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh";
|
||||
rm ~/.zshrc;
|
||||
cp ~/.zshrc.pre-oh-my-zsh ~/.zshrc;
|
||||
echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc";
|
||||
|
||||
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
|
||||
then
|
||||
ZSHRC_SAVE=".zshrc.omz-uninstalled-`date +%Y%m%d%H%M%S`";
|
||||
echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}";
|
||||
mv ~/.zshrc ~/${ZSHRC_SAVE};
|
||||
fi
|
||||
|
||||
mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc;
|
||||
|
||||
source ~/.zshrc;
|
||||
else
|
||||
echo "Switching back to bash"
|
||||
|
|
@ -17,4 +25,4 @@ else
|
|||
source /etc/profile
|
||||
fi
|
||||
|
||||
echo "Thanks for trying out Oh My Zsh. It's been uninstalled."
|
||||
echo "Thanks for trying out Oh My Zsh. It's been uninstalled."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue