Commit 00eb4658 authored by Andrew Janke's avatar Andrew Janke
Browse files

Merge branch 'master' into fold-terminalapp-plugin-into-termsupport

parents 47d19cc5 192de6bc
...@@ -5,6 +5,8 @@ wd ...@@ -5,6 +5,8 @@ wd
`wd` (*warp directory*) lets you jump to custom directories in zsh, without using `cd`. Why? Because `cd` seems ineffecient when the folder is frequently visited or has a long path. `wd` (*warp directory*) lets you jump to custom directories in zsh, without using `cd`. Why? Because `cd` seems ineffecient when the folder is frequently visited or has a long path.
*NOTE*: If you are not using zsh, check out the `ruby` branch which has `wd` implemented as a gem.
### Setup ### Setup
...@@ -33,7 +35,7 @@ Run either in terminal: ...@@ -33,7 +35,7 @@ Run either in terminal:
* Add `wd` function to `.zshrc` (or `.profile` etc.): * Add `wd` function to `.zshrc` (or `.profile` etc.):
wd() { wd() {
. ~/paht/to/wd/wd.sh . ~/path/to/cloned/repo/wd/wd.sh
} }
* Install manpage. From `wd`'s base directory (requires root permissions): * Install manpage. From `wd`'s base directory (requires root permissions):
...@@ -84,7 +86,15 @@ Also, you may have to force a rebuild of `zcompdump` by running: ...@@ -84,7 +86,15 @@ Also, you may have to force a rebuild of `zcompdump` by running:
* List all warp points (stored in `~/.warprc`): * List all warp points (stored in `~/.warprc`):
$ wd ls $ wd list
* List files in given warp point:
$ wd ls foo
* Show path of given warp point:
$ wd path foo
* List warp points to current directory, or optionally, path to given warp point: * List warp points to current directory, or optionally, path to given warp point:
......
...@@ -20,10 +20,13 @@ function _wd() { ...@@ -20,10 +20,13 @@ function _wd() {
'add:Adds the current working directory to your warp points' 'add:Adds the current working directory to your warp points'
'add!:Overwrites existing warp point' 'add!:Overwrites existing warp point'
'rm:Removes the given warp point' 'rm:Removes the given warp point'
'ls:Outputs all stored warp points' 'list:Outputs all stored warp points'
'show:Outputs all warp points that point to the current directory or shows a specific target directory for a point' 'ls:Show files from given warp point'
'path:Show path to given warp point'
'show:Outputs all warp points that point to the current directory or shows a specific target directory for a point' 'show:Outputs all warp points that point to the current directory or shows a specific target directory for a point'
'help:Show this extremely helpful text' 'help:Show this extremely helpful text'
'clean:Remove points warping to nonexistent directories'
'clean!:Remove nonexistent directories without confirmation'
'..:Go back to last directory' '..:Go back to last directory'
) )
...@@ -47,6 +50,12 @@ function _wd() { ...@@ -47,6 +50,12 @@ function _wd() {
show) show)
_describe -t points "Warp points" warp_points && ret=0 _describe -t points "Warp points" warp_points && ret=0
;; ;;
ls)
_describe -t points "Warp points" warp_points && ret=0
;;
path)
_describe -t points "Warp points" warp_points && ret=0
;;
esac esac
;; ;;
esac esac
......
...@@ -80,7 +80,9 @@ Commands: ...@@ -80,7 +80,9 @@ Commands:
rm <point> Removes the given warp point rm <point> Removes the given warp point
show Print warp points to current directory show Print warp points to current directory
show <point> Print path to given warp point show <point> Print path to given warp point
ls Print all stored warp points list Print all stored warp points
ls <point> Show files from given warp point
path <point> Show the path to given warp point
clean! Remove points warping to nonexistent directories clean! Remove points warping to nonexistent directories
-v | --version Print version -v | --version Print version
...@@ -96,7 +98,7 @@ wd_exit_fail() ...@@ -96,7 +98,7 @@ wd_exit_fail()
{ {
local msg=$1 local msg=$1
wd_print_msg $WD_RED $1 wd_print_msg $WD_RED $msg
WD_EXIT_CODE=1 WD_EXIT_CODE=1
} }
...@@ -108,6 +110,22 @@ wd_exit_warn() ...@@ -108,6 +110,22 @@ wd_exit_warn()
WD_EXIT_CODE=1 WD_EXIT_CODE=1
} }
wd_getdir()
{
local name_arg=$1
point=$(wd_show $name_arg)
dir=${point:28+$#name_arg+7}
if [[ -z $name_arg ]]; then
wd_exit_fail "You must enter a warp point"
break
elif [[ -z $dir ]]; then
wd_exit_fail "Unknown warp point '${name_arg}'"
break
fi
}
# core # core
wd_warp() wd_warp()
...@@ -201,6 +219,18 @@ wd_list_all() ...@@ -201,6 +219,18 @@ wd_list_all()
done <<< $(sed "s:${HOME}:~:g" $WD_CONFIG) done <<< $(sed "s:${HOME}:~:g" $WD_CONFIG)
} }
wd_ls()
{
wd_getdir $1
ls $dir
}
wd_path()
{
wd_getdir $1
echo $(echo $dir | sed "s:${HOME}:~:g")
}
wd_show() wd_show()
{ {
local name_arg=$1 local name_arg=$1
...@@ -316,7 +346,7 @@ do ...@@ -316,7 +346,7 @@ do
done < $WD_CONFIG done < $WD_CONFIG
# get opts # get opts
args=$(getopt -o a:r:c:lhs -l add:,rm:,clean\!,ls,help,show -- $*) args=$(getopt -o a:r:c:lhs -l add:,rm:,clean\!,list,ls:,path:,help,show -- $*)
# check if no arguments were given, and that version is not set # check if no arguments were given, and that version is not set
if [[ ($? -ne 0 || $#* -eq 0) && -z $wd_print_version ]] if [[ ($? -ne 0 || $#* -eq 0) && -z $wd_print_version ]]
...@@ -349,10 +379,18 @@ else ...@@ -349,10 +379,18 @@ else
wd_remove $2 wd_remove $2
break break
;; ;;
-l|--list|ls) -l|list)
wd_list_all wd_list_all
break break
;; ;;
-ls|ls)
wd_ls $2
break
;;
-p|--path|path)
wd_path $2
break
;;
-h|--help|help) -h|--help|help)
wd_print_usage wd_print_usage
break break
......
...@@ -11,18 +11,10 @@ function web_search() { ...@@ -11,18 +11,10 @@ function web_search() {
yahoo "https://search.yahoo.com/search?p=" yahoo "https://search.yahoo.com/search?p="
duckduckgo "https://www.duckduckgo.com/?q=" duckduckgo "https://www.duckduckgo.com/?q="
yandex "https://yandex.ru/yandsearch?text=" yandex "https://yandex.ru/yandsearch?text="
github "https://github.com/search?q="
baidu "https://www.baidu.com/s?wd="
) )
# define the open command
case "$OSTYPE" in
darwin*) open_cmd="open" ;;
cygwin*) open_cmd="cygstart" ;;
linux*) open_cmd="xdg-open" ;;
*) echo "Platform $OSTYPE not supported"
return 1
;;
esac
# check whether the search engine is supported # check whether the search engine is supported
if [[ -z "$urls[$1]" ]]; then if [[ -z "$urls[$1]" ]]; then
echo "Search engine $1 not supported." echo "Search engine $1 not supported."
...@@ -40,7 +32,7 @@ function web_search() { ...@@ -40,7 +32,7 @@ function web_search() {
url="${(j://:)${(s:/:)urls[$1]}[1,2]}" url="${(j://:)${(s:/:)urls[$1]}[1,2]}"
fi fi
nohup $open_cmd "$url" &>/dev/null open_command "$url"
} }
...@@ -49,6 +41,8 @@ alias google='web_search google' ...@@ -49,6 +41,8 @@ alias google='web_search google'
alias yahoo='web_search yahoo' alias yahoo='web_search yahoo'
alias ddg='web_search duckduckgo' alias ddg='web_search duckduckgo'
alias yandex='web_search yandex' alias yandex='web_search yandex'
alias github='web_search github'
alias baidu='web_search baidu'
#add your own !bang searches here #add your own !bang searches here
alias wiki='web_search duckduckgo \!w' alias wiki='web_search duckduckgo \!w'
......
...@@ -136,3 +136,25 @@ alias wpwd='wp widget delete' ...@@ -136,3 +136,25 @@ alias wpwd='wp widget delete'
alias wpwl='wp widget list' alias wpwl='wp widget list'
alias wpwm='wp widget move' alias wpwm='wp widget move'
alias wpwu='wp widget update' alias wpwu='wp widget update'
autoload -U +X bashcompinit && bashcompinit
# bash completion for the `wp` command
_wp_complete() {
local cur=${COMP_WORDS[COMP_CWORD]}
IFS=$'\n'; # want to preserve spaces at the end
local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")"
if [[ "$opts" =~ \<file\>\s* ]]
then
COMPREPLY=( $(compgen -f -- $cur) )
elif [[ $opts = "" ]]
then
COMPREPLY=( $(compgen -f -- $cur) )
else
COMPREPLY=( ${opts[*]} )
fi
}
complete -o nospace -F _wp_complete wp
...@@ -42,12 +42,15 @@ ...@@ -42,12 +42,15 @@
* `zsw` aliases `rm .zeus.sock` * `zsw` aliases `rm .zeus.sock`
* `zweep` aliases `rm .zeus.sock` * `zweep` aliases `rm .zeus.sock`
`zdbr` aliases `zeus rake db:reset db:test:prepare` * `zdbr` aliases `zeus rake db:reset db:test:prepare`
`zdbreset` aliases `zeus rake db:reset db:test:prepare` * `zdbreset` aliases `zeus rake db:reset db:test:prepare`
`zdbm` aliases `zeus rake db:migrate db:test:prepare` * `zdbm` aliases `zeus rake db:migrate db:test:prepare`
`zdbmigrate` aliases `zeus rake db:migrate db:test:prepare` * `zdbmigrate` aliases `zeus rake db:migrate db:test:prepare`
`zdbc` aliases `zeus rake db:create` * `zdbc` aliases `zeus rake db:create`
`zdbcm` aliases `zeus rake db:create db:migrate db:test:prepare` * `zdbcm` aliases `zeus rake db:create db:migrate db:test:prepare`
## Installation
Add zeus to the plugins line of your `.zshconfig` file (e.g. `plugins=(rails git zeus)`)
...@@ -19,8 +19,8 @@ alias zsr='zeus server' ...@@ -19,8 +19,8 @@ alias zsr='zeus server'
alias zerver='zeus server' alias zerver='zeus server'
# Rake # Rake
alias zr='zeus rake' alias zr='noglob zeus rake'
alias zake='zeus rake' alias zake='noglob zeus rake'
# Generate # Generate
alias zg='zeus generate' alias zg='zeus generate'
......
...@@ -10,6 +10,10 @@ ZSH_THEME="robbyrussell" ...@@ -10,6 +10,10 @@ ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion. # Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true" # CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks. # Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true" # DISABLE_AUTO_UPDATE="true"
......
...@@ -42,7 +42,7 @@ GREEN_BASE_START="${PR_RESET}${PR_GREY}>${PR_RESET}${PR_GREEN}>${PR_BRIGHT_GREEN ...@@ -42,7 +42,7 @@ GREEN_BASE_START="${PR_RESET}${PR_GREY}>${PR_RESET}${PR_GREEN}>${PR_BRIGHT_GREEN
GREEN_START_P1="${PR_RESET}${GREEN_BASE_START}${PR_RESET} " GREEN_START_P1="${PR_RESET}${GREEN_BASE_START}${PR_RESET} "
DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}" DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}"
VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}" VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}"
Vcs_CLEAN_COLOR="${PR_RESET}${PR_GREEN}" VCS_CLEAN_COLOR="${PR_RESET}${PR_GREEN}"
VCS_SUFIX_COLOR="${PR_RESET}${PR_RED}${PR_RESET}" VCS_SUFIX_COLOR="${PR_RESET}${PR_RED}${PR_RESET}"
# ########## COLOR ########### # ########## COLOR ###########
# ########## SVN ########### # ########## SVN ###########
......
...@@ -26,7 +26,13 @@ ...@@ -26,7 +26,13 @@
# A few utility functions to make it easy and re-usable to draw segmented prompts # A few utility functions to make it easy and re-usable to draw segmented prompts
CURRENT_BG='NONE' CURRENT_BG='NONE'
SEGMENT_SEPARATOR=''
# Fix odd char on mac
if [[ `uname` == 'Darwin' ]]; then
SEGMENT_SEPARATOR='\ue0b0'
else
SEGMENT_SEPARATOR=''
fi
# Begin a segment # Begin a segment
# Takes two arguments, background and foreground. Both can be omitted, # Takes two arguments, background and foreground. Both can be omitted,
...@@ -126,7 +132,7 @@ prompt_hg() { ...@@ -126,7 +132,7 @@ prompt_hg() {
if `hg st | grep -q "^\?"`; then if `hg st | grep -q "^\?"`; then
prompt_segment red black prompt_segment red black
st='±' st='±'
elif `hg st | grep -q "^(M|A)"`; then elif `hg st | grep -q "^[MA]"`; then
prompt_segment yellow black prompt_segment yellow black
st='±' st='±'
else else
......
...@@ -38,34 +38,32 @@ function _ruby_version() { ...@@ -38,34 +38,32 @@ function _ruby_version() {
# Determine the time since last commit. If branch is clean, # Determine the time since last commit. If branch is clean,
# use a neutral color, otherwise colors will vary according to time. # use a neutral color, otherwise colors will vary according to time.
function _git_time_since_commit() { function _git_time_since_commit() {
if git rev-parse --git-dir > /dev/null 2>&1; then # Only proceed if there is actually a commit.
# Only proceed if there is actually a commit. if git log -1 > /dev/null 2>&1; then
if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then # Get the last commit.
# Get the last commit. last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null)
last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null) now=$(date +%s)
now=$(date +%s) seconds_since_last_commit=$((now-last_commit))
seconds_since_last_commit=$((now-last_commit))
# Totals
# Totals minutes=$((seconds_since_last_commit / 60))
minutes=$((seconds_since_last_commit / 60)) hours=$((seconds_since_last_commit/3600))
hours=$((seconds_since_last_commit/3600))
# Sub-hours and sub-minutes
# Sub-hours and sub-minutes days=$((seconds_since_last_commit / 86400))
days=$((seconds_since_last_commit / 86400)) sub_hours=$((hours % 24))
sub_hours=$((hours % 24)) sub_minutes=$((minutes % 60))
sub_minutes=$((minutes % 60))
if [ $hours -gt 24 ]; then
if [ $hours -gt 24 ]; then commit_age="${days}d"
commit_age="${days}d" elif [ $minutes -gt 60 ]; then
elif [ $minutes -gt 60 ]; then commit_age="${sub_hours}h${sub_minutes}m"
commit_age="${sub_hours}h${sub_minutes}m" else
else commit_age="${minutes}m"
commit_age="${minutes}m"
fi
color=$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL
echo "$color$commit_age%{$reset_color%}"
fi fi
color=$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL
echo "$color$commit_age%{$reset_color%}"
fi fi
} }
...@@ -99,4 +97,3 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[grey]%}" ...@@ -99,4 +97,3 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[grey]%}"
export LSCOLORS="exfxcxdxbxegedabagacad" export LSCOLORS="exfxcxdxbxegedabagacad"
export LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:' export LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:'
export GREP_COLOR='1;33' export GREP_COLOR='1;33'
# the svn plugin has to be activated for this to work. # the svn plugin has to be activated for this to work.
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}' PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[yellow]%} ✗ %{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[yellow]%} ✗ %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) " ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) "
ZSH_PROMPT_BASE_COLOR="%{$fg_bold[blue]%}" ZSH_PROMPT_BASE_COLOR="%{$fg_bold[blue]%}"
ZSH_THEME_REPO_NAME_COLOR="%{$fg_bold[red]%}" ZSH_THEME_REPO_NAME_COLOR="%{$fg_bold[red]%}"
ZSH_THEME_SVN_PROMPT_PREFIX="svn:(" ZSH_THEME_SVN_PROMPT_PREFIX="svn:("
ZSH_THEME_SVN_PROMPT_SUFFIX=")" ZSH_THEME_SVN_PROMPT_SUFFIX=")"
ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%} ✘ %{$reset_color%}" ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%} ✘ %{$reset_color%}"
ZSH_THEME_SVN_PROMPT_CLEAN=" " ZSH_THEME_SVN_PROMPT_CLEAN=" "
\ No newline at end of file
...@@ -13,7 +13,7 @@ patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset ...@@ -13,7 +13,7 @@ patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset
} }
function box_name { function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || echo $SHORT_HOST || echo $HOST [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST}
} }
PROMPT=' PROMPT='
......
...@@ -21,7 +21,7 @@ function prompt_char { ...@@ -21,7 +21,7 @@ function prompt_char {
} }
function box_name { function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || echo $SHORT_HOST || echo $HOST [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST}
} }
......
...@@ -17,7 +17,7 @@ function prompt_char { ...@@ -17,7 +17,7 @@ function prompt_char {
} }
function box_name { function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || echo $SHORT_HOST || echo $HOST [ -f ~/.box-name ] && cat ~/.box-name || echo ${SHORT_HOST:-$HOST}
} }
local ruby_env='' local ruby_env=''
......
PROMPT=$'%{$fg[green]%}%n@%m: %{$reset_color%}%{$fg[blue]%}%/%{$reset_color%} local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
%{$fg_bold[red]%}➜ %{$reset_color%} ' PROMPT=$'%{$fg[green]%}%n@%m: %{$reset_color%}%{$fg[blue]%}%/ %{$reset_color%}%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}
${ret_status} %{$reset_color%} '
PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}" PROMPT2="%{$fg_blod[black]%}%_> %{$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]%})"
# reference colors # Michele Bologna's theme
GREEN="%{$fg_bold[green]%}" # http://michelebologna.net
RED="%{$fg_bold[red]%}" #
CYAN="%{$fg_bold[cyan]%}" # This a theme for oh-my-zsh. Features a colored prompt with:
YELLOW="%{$fg_bold[yellow]%}" # * username@host: [jobs] [git] workdir %
BLUE="%{$fg_bold[blue]%}" # * hostname color is based on hostname characters. When using as root, the
MAGENTA="%{$fg_bold[magenta]%}" # prompt shows only the hostname in red color.
WHITE="%{$fg_bold[white]%}" # * [jobs], if applicable, counts the number of suspended jobs tty
# * [git], if applicable, represents the status of your git repo (more on that
COLOR_ARRAY=($GREEN $RED $CYAN $YELLOW $BLUE $MAGENTA $WHITE) # later)
# * '%' prompt will be green if last command return value is 0, yellow otherwise.
# color reset #
RESET_COLOR="%{$reset_color%}" # git prompt is inspired by official git contrib prompt:
# https://github.com/git/git/tree/master/contrib/completion/git-prompt.sh
# which color should be applied? # and it adds:
USERNAME_NORMAL_COLOR=$WHITE # * the current branch
USERNAME_ROOT_COLOR=$RED # * '%' if there are untracked files
HOSTNAME_NORMAL_COLOR=$BLUE # * '$' if there are stashed changes
# uncomment next line if you want auto-generated hostname color # * '*' if there are modified files
#for i in $HOST; HOSTNAME_NORMAL_COLOR=$COLOR_ARRAY[$[((#i))%7+1]] # * '+' if there are added files
HOSTNAME_ROOT_COLOR=$RED # * '<' if local repo is behind remote repo
HOSTNAME_COLOR=%(!.$HOSTNAME_ROOT_COLOR.$HOSTNAME_NORMAL_COLOR) # * '>' if local repo is ahead remote repo
CURRENT_DIR_COLOR=$CYAN # * '=' if local repo is equal to remote repo (in sync)
# * '<>' if local repo is diverged
# zsh commands
USERNAME_COMMAND="%n" local green="%{$fg_bold[green]%}"
HOSTNAME_COMMAND="%m" local red="%{$fg_bold[red]%}"
CURRENT_DIR="%~" local cyan="%{$fg_bold[cyan]%}"
local yellow="%{$fg_bold[yellow]%}"
# output: colors + commands local blue="%{$fg_bold[blue]%}"
USERNAME_OUTPUT="%(!..$USERNAME_NORMAL_COLOR$USERNAME_COMMAND$RESET_COLOR@)" local magenta="%{$fg_bold[magenta]%}"
HOSTNAME_OUTPUT="$HOSTNAME_COLOR$HOSTNAME_COMMAND$RESET_COLOR" local white="%{$fg_bold[white]%}"
CURRENT_DIR_OUTPUT="$CURRENT_DIR_COLOR$CURRENT_DIR" local reset="%{$reset_color%}"
LAST_COMMAND_OUTPUT="%(?.%(!.$RED.$GREEN).$YELLOW)"
local -a color_array
# git theming color_array=($green $red $cyan $yellow $blue $magenta $white)
ZSH_THEME_GIT_PROMPT_PREFIX="("
local username_normal_color=$white
local username_root_color=$red
local hostname_root_color=$red
# calculating hostname color with hostname characters
for i in `hostname`; local hostname_normal_color=$color_array[$[((#i))%7+1]]
local -a hostname_color
hostname_color=%(!.$hostname_root_color.$hostname_normal_color)
local current_dir_color=$blue
local username_command="%n"
local hostname_command="%m"
local current_dir="%~"
local username_output="%(!..$username_normal_color$username_command$reset@)"
local hostname_output="$hostname_color$hostname_command$reset"
local current_dir_output="$current_dir_color$current_dir$reset"
local jobs_bg="${red}fg: %j$reset"
local last_command_output="%(?.%(!.$red.$green).$yellow)"
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY=")$RED*" ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=")" ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_UNTRACKED="%%"
ZSH_THEME_GIT_PROMPT_MODIFIED="*"
ZSH_THEME_GIT_PROMPT_ADDED="+"
ZSH_THEME_GIT_PROMPT_STASHED="$"
ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="="
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">"
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<"
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="<>"
# wrap all together PROMPT='$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)'
PROMPT='$USERNAME_OUTPUT$HOSTNAME_OUTPUT:$CURRENT_DIR_OUTPUT $LAST_COMMAND_OUTPUT%#$RESET_COLOR ' PROMPT+='$(__git_ps1)'
RPROMPT='%1(j.fg: [%j].) $GREEN$(git_prompt_info)$RESET_COLOR [%@]' PROMPT+=" $last_command_output%#$reset "
RPROMPT=''
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}[" ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}["
ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$reset_color%}]%{$reset_color%} " ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$fg[white]%}]%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_CLEAN="]%{$reset_color%} " ZSH_THEME_GIT_PROMPT_CLEAN="]%{$reset_color%} "
ZSH_THEME_SVN_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX ZSH_THEME_SVN_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX
ZSH_THEME_SVN_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX ZSH_THEME_SVN_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX
ZSH_THEME_SVN_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY ZSH_THEME_SVN_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY
ZSH_THEME_SVN_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN ZSH_THEME_SVN_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN
ZSH_THEME_HG_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX
ZSH_THEME_HG_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX
ZSH_THEME_HG_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY
ZSH_THEME_HG_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN
vcs_status() { vcs_status() {
if [[ ( $(whence in_svn) != "" ) && ( $(in_svn) == 1 ) ]]; then if [[ $(whence in_svn) != "" ]] && in_svn; then
svn_prompt_info svn_prompt_info
elif [[ $(whence in_hg) != "" ]] && in_hg; then
hg_prompt_info
else else
git_prompt_info git_prompt_info
fi fi
} }
PROMPT='%2~ $(vcs_status)»%b ' PROMPT='%2~ $(vcs_status)»%b '
\ No newline at end of file
...@@ -15,8 +15,8 @@ ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}✱" ...@@ -15,8 +15,8 @@ ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}✱"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✗" ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✗"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➦" ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➦"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%}✂" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%}✂"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}✈" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[blue]%}✈"
ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$fg[grey]%}" ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$fg[blue]%}"
ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}"
function mygit() { function mygit() {
......
# terminal coloring
export CLICOLOR=1
export LSCOLORS=dxFxCxDxBxegedabagacad
local git_branch='$(git_prompt_info)%{$reset_color%}$(git_remote_status)'
PROMPT="%{$fg[green]%}╭─%n@%m %{$reset_color%}%{$fg[yellow]%}in %~ %{$reset_color%}${git_branch}
%{$fg[green]%}╰\$ %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%}on "
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}%{$fg[red]%} ✘ %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔ %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED=true
ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX="%{$fg[yellow]%}("
ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX="%{$fg[yellow]%})%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=" +"
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR=%{$fg[green]%}
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE=" -"
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR=%{$fg[red]%}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment