commit
8411a39a86
31 changed files with 598 additions and 29 deletions
@ -0,0 +1,2 @@ |
||||
# Add your own custom plugins in the custom/plugins directory. Plugins placed |
||||
# here will override ones with the same name in the main plugins directory. |
||||
@ -0,0 +1,26 @@ |
||||
stat -f%m . > /dev/null 2>&1 |
||||
if [ "$?" = 0 ]; then |
||||
stat_cmd=(stat -f%m) |
||||
else |
||||
stat_cmd=(stat -L --format=%y) |
||||
fi |
||||
|
||||
_ant_does_target_list_need_generating () { |
||||
if [ ! -f .ant_targets ]; then return 0; |
||||
else |
||||
accurate=$($stat_cmd -f%m .ant_targets) |
||||
changed=$($stat_cmd -f%m build.xml) |
||||
return $(expr $accurate '>=' $changed) |
||||
fi |
||||
} |
||||
|
||||
_ant () { |
||||
if [ -f build.xml ]; then |
||||
if _ant_does_target_list_need_generating; then |
||||
sed -n '/<target/s/<target.*name="\([^"]*\).*$/\1/p' build.xml > .ant_targets |
||||
fi |
||||
compadd `cat .ant_targets` |
||||
fi |
||||
} |
||||
|
||||
compdef _ant ant |
||||
@ -0,0 +1,3 @@ |
||||
if [ -f `brew --prefix`/etc/autojump ]; then |
||||
. `brew --prefix`/etc/autojump |
||||
fi |
||||
@ -0,0 +1,13 @@ |
||||
# Move /usr/local/bin (path where brews are linked) to the front of the path |
||||
# This will allow us to override system binaries like ruby with our brews |
||||
# TODO: Do this in a more compatible way. |
||||
# What if someone doesn't have /usr/bin in their path? |
||||
export PATH=`echo $PATH | sed -e 's|/usr/local/bin||' -e 's|::|:|g'` # Remove /usr/local/bin |
||||
export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/bin:&|'` # Add it in front of /usr/bin |
||||
export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/sbin:&|'` # Add /usr/local/sbin |
||||
|
||||
alias brews='brew list -1' |
||||
|
||||
function brew-link-completion { |
||||
ln -s "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" "$ZSH/plugins/brew/_brew.official" |
||||
} |
||||
@ -0,0 +1,26 @@ |
||||
# Based on ssh-agent code |
||||
|
||||
local GPG_ENV=$HOME/.gnupg/gpg-agent.env |
||||
|
||||
function start_agent { |
||||
/usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV} > /dev/null |
||||
chmod 600 ${GPG_ENV} |
||||
. ${GPG_ENV} > /dev/null |
||||
} |
||||
|
||||
# Source GPG agent settings, if applicable |
||||
if [ -f "${GPG_ENV}" ]; then |
||||
. ${GPG_ENV} > /dev/null |
||||
ps -ef | grep ${SSH_AGENT_PID} | grep gpg-agent > /dev/null || { |
||||
start_agent; |
||||
} |
||||
else |
||||
start_agent; |
||||
fi |
||||
|
||||
export GPG_AGENT_INFO |
||||
export SSH_AUTH_SOCK |
||||
export SSH_AGENT_PID |
||||
|
||||
GPG_TTY=$(tty) |
||||
export GPG_TTY |
||||
@ -0,0 +1,8 @@ |
||||
# This works if you installed node via homebrew. |
||||
export NODE_PATH="/usr/local/lib/node" |
||||
|
||||
# Open the node api for your current version to the optional section. |
||||
# TODO: Make the section part easier to use. |
||||
function node-api { |
||||
open "http://nodejs.org/docs/$(node --version)/api/all.html#$1" |
||||
} |
||||
@ -0,0 +1,2 @@ |
||||
# TODO: Don't do this in such a weird way. |
||||
export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/share/npm/bin:&|'` |
||||
@ -0,0 +1,10 @@ |
||||
# Thanks to Christopher Sexton |
||||
# https://gist.github.com/965032 |
||||
function kapow { |
||||
touch ~/.pow/$1/tmp/restart.txt |
||||
if [ $? -eq 0 ]; then |
||||
echo "$fg[yellow]Pow restarting $1...$reset_color" |
||||
fi |
||||
} |
||||
|
||||
compctl -W ~/.pow -/ kapow |
||||
@ -1,4 +1,6 @@ |
||||
# TODO: Make this compatible with rvm. |
||||
# Run sudo gem on the system ruby, not the active ruby. |
||||
alias sgem='sudo gem' |
||||
|
||||
# Find ruby file |
||||
alias rfind='find . -name *.rb | xargs grep -n' |
||||
alias rfind='find . -name *.rb | xargs grep -n' |
||||
|
||||
@ -0,0 +1,147 @@ |
||||
#compdef rvm |
||||
|
||||
local curcontext="$curcontext" state line cmds ret=1 |
||||
|
||||
_arguments -C \ |
||||
'(- 1 *)'{-v,--version}'[display version information]' \ |
||||
'(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \ |
||||
'(--prefix)--prefix[path for all rvm files (~/.rvm/), with trailing slash!]:path:_files' \ |
||||
'(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \ |
||||
'(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \ |
||||
'(--archives)--archives[directory for downladed files (~/.rvm/archives/)]:path:_files' \ |
||||
'-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \ |
||||
'-e[Execute code from the command line]:code' \ |
||||
'(-G)-G[root gem path to use]:path:_files' \ |
||||
'(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \ |
||||
'(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \ |
||||
'(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \ |
||||
'(-C|--configure)'{-C,--configure}'=[custom configure options]' \ |
||||
'(--nice)--nice[process niceness (for slow computers, default 0)]:number' \ |
||||
'(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \ |
||||
'(--head)--head[with update, updates rvm to git head version]' \ |
||||
'(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \ |
||||
'(--default)--default[with ruby select, sets a default ruby for new shells]' \ |
||||
'(--debug)--debug[Toggle debug mode on for very verbose output]' \ |
||||
'(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \ |
||||
'(--force)--force[Force install, removes old install & source before install]' \ |
||||
'(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \ |
||||
'(--latest)--latest[with gemset --dump skips version strings for latest gem]' \ |
||||
'(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \ |
||||
'(--docs)--docs[with install, attempt to generate ri after installation]' \ |
||||
'(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \ |
||||
'1: :->cmds' \ |
||||
'*: :->args' && ret=0 |
||||
|
||||
case $state in |
||||
cmds) |
||||
cmds=( |
||||
"version:show the rvm version installed in rvm_path" |
||||
"use:setup current shell to use a specific ruby version" |
||||
"reload:reload rvm source itself (useful after changing rvm source)" |
||||
"implode:(seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm)." |
||||
"update:upgrades rvm to the latest version." |
||||
"reset:remove current and stored default & system settings." |
||||
"info :show the *current* environment information for current ruby" |
||||
"current:print the *current* ruby version and the name of any gemset being used." |
||||
"debug:show info plus additional information for common issues" |
||||
"install:install one or many ruby versions" |
||||
"uninstall:uninstall one or many ruby versions, leaves their sources" |
||||
"remove:uninstall one or many ruby versions and remove their sources" |
||||
"migrate:Lets you migrate all gemsets from one ruby to another." |
||||
"upgrade:Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically." |
||||
"wrapper:generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like." |
||||
"cleanup:Lets you remove stale source folders / archives and other miscellaneous data associated with rvm." |
||||
"repair:Lets you repair parts of your environment e.g. wrappers, env files and and similar files (e.g. general maintenance)." |
||||
"snapshot:Lets your backup / restore an rvm installation in a lightweight manner." |
||||
"disk-usage:Tells you how much disk space rvm install is using." |
||||
"tools:Provides general information about the ruby environment, primarily useful when scripting rvm." |
||||
"docs:Tools to make installing ri and rdoc documentation easier." |
||||
"rvmrc:Tools related to managing rvmrc trust and loading." |
||||
"exec:runs an arbitrary command as a set operation." |
||||
"ruby:runs a named ruby file against specified and/or all rubies" |
||||
"gem:runs a gem command using selected ruby's 'gem'" |
||||
"rake:runs a rake task against specified and/or all rubies" |
||||
"tests:runs 'rake test' across selected ruby versions" |
||||
"specs:runs 'rake spec' across selected ruby versions" |
||||
"monitor:Monitor cwd for testing, run rake {spec,test} on changes." |
||||
"gemset:gemsets: http://rvm.beginrescueend.com/gemsets/" |
||||
"rubygems:Switches the installed version of rubygems for the current ruby." |
||||
"gemdir:display the path to the current gem directory (GEM_HOME)." |
||||
"srcdir:display the path to rvm source directory (may be yanked)" |
||||
"fetch:Performs an archive / src fetch only of the selected ruby." |
||||
"list:show currently installed rubies, interactive output." |
||||
"package:Install a dependency package {readline,iconv,zlib,openssl}" |
||||
"notes:Display notes, with operating system specifics." |
||||
"export:Temporarily set an environment variable in the current shell." |
||||
"unexport:Undo changes made to the environment by 'rvm export'." |
||||
) |
||||
_describe -t commands 'rvm command' cmds && ret=0 |
||||
;; |
||||
args) |
||||
case $line[1] in |
||||
(use|uninstall|remove|list) |
||||
_values -S , 'rubies' $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') default system && ret=0 |
||||
;; |
||||
(install|fetch) |
||||
_values -S , 'rubies' $(rvm list known_strings) && ret=0 |
||||
;; |
||||
gemset) |
||||
if (( CURRENT == 3 )); then |
||||
_values 'gemset_commands' \ |
||||
'import' \ |
||||
'export' \ |
||||
'create' \ |
||||
'copy' \ |
||||
'rename' \ |
||||
'empty' \ |
||||
'delete' \ |
||||
'name' \ |
||||
'dir' \ |
||||
'list' \ |
||||
'list_all' \ |
||||
'gemdir' \ |
||||
'install' \ |
||||
'pristine' \ |
||||
'clear' \ |
||||
'use' \ |
||||
'update' \ |
||||
'unpack' \ |
||||
'globalcache' |
||||
else |
||||
_values -S , 'gemsets' $(rvm gemset list | grep -v gemset 2>/dev/null) |
||||
fi |
||||
ret=0 |
||||
;; |
||||
package) |
||||
if (( CURRENT == 3 )); then |
||||
_values 'package_commands' \ |
||||
'install' \ |
||||
'uninstall' |
||||
else |
||||
_values 'packages' \ |
||||
'readline' \ |
||||
'iconv' \ |
||||
'curl' \ |
||||
'openssl' \ |
||||
'zlib' \ |
||||
'autoconf' \ |
||||
'ncurses' \ |
||||
'pkgconfig' \ |
||||
'gettext' \ |
||||
'glib' \ |
||||
'mono' \ |
||||
'llvm' \ |
||||
'libxml2' \ |
||||
'libxslt' \ |
||||
'libyaml' |
||||
fi |
||||
ret=0 |
||||
;; |
||||
*) |
||||
(( ret )) && _message 'no more arguments' |
||||
;; |
||||
esac |
||||
;; |
||||
esac |
||||
|
||||
return ret |
||||
@ -0,0 +1,52 @@ |
||||
fpath=($ZSH/plugins/rvm $fpath) |
||||
autoload -U compinit |
||||
compinit -i |
||||
|
||||
alias rubies='rvm list rubies' |
||||
alias gemsets='rvm gemset list' |
||||
|
||||
local ruby18='ruby-1.8.7-p334' |
||||
local ruby19='ruby-1.9.2-p180' |
||||
|
||||
function rb18 { |
||||
if [ -z "$1" ]; then |
||||
rvm use "$ruby18" |
||||
else |
||||
rvm use "$ruby18@$1" |
||||
fi |
||||
} |
||||
|
||||
_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`} |
||||
compdef _rb18 rb18 |
||||
|
||||
function rb19 { |
||||
if [ -z "$1" ]; then |
||||
rvm use "$ruby19" |
||||
else |
||||
rvm use "$ruby19@$1" |
||||
fi |
||||
} |
||||
|
||||
_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`} |
||||
compdef _rb19 rb19 |
||||
|
||||
function rvm-update { |
||||
rvm get head |
||||
rvm reload # TODO: Reload rvm completion? |
||||
} |
||||
|
||||
function rvm-link-completion { |
||||
ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official" |
||||
} |
||||
|
||||
# TODO: Make this usable w/o rvm. |
||||
function gems { |
||||
local current_ruby=`rvm-prompt i v p` |
||||
local current_gemset=`rvm-prompt g` |
||||
|
||||
gem list $@ | sed \ |
||||
-Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$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$current_gemset$/$fg[green]&$reset_color/g" |
||||
} |
||||
@ -0,0 +1,4 @@ |
||||
#compdef thor |
||||
#autoload |
||||
|
||||
compadd `thor list | grep thor | cut -d " " -f 2` |
||||
@ -0,0 +1,6 @@ |
||||
PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' |
||||
|
||||
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]%})" |
||||
@ -0,0 +1,15 @@ |
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}[" |
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" |
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$reset_color%}" |
||||
ZSH_THEME_GIT_PROMPT_CLEAN="" |
||||
|
||||
#Customized git status, oh-my-zsh currently does not allow render dirty status before branch |
||||
git_custom_status() { |
||||
local cb=$(current_branch) |
||||
if [ -n "$cb" ]; then |
||||
echo "- $ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" |
||||
fi |
||||
} |
||||
|
||||
|
||||
PROMPT='%2~ $(git_custom_status) »%b ' |
||||
@ -0,0 +1,11 @@ |
||||
if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi |
||||
|
||||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" |
||||
|
||||
PROMPT='%{$fg[green]%}[%*]%{$reset_color%} %{$fg_no_bold[cyan]%}%n %{${fg_bold[blue]}%}::%{$reset_color%} %{$fg[yellow]%}%m%{$reset_color%} %{$fg_no_bold[magenta]%} ➜ %{$reset_color%} %{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' |
||||
|
||||
RPS1="${return_code}" |
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹" |
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" |
||||
|
||||
@ -0,0 +1,15 @@ |
||||
if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi |
||||
|
||||
local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})" |
||||
|
||||
PROMPT=' |
||||
%{$fg_bold[cyan]%}%n%{$reset_color%}%{$fg[yellow]%}@%{$reset_color%}%{$fg_bold[blue]%}%m%{$reset_color%}:%{${fg_bold[green]}%}%~%{$reset_color%}$(git_prompt_info) |
||||
%{${fg[$CARETCOLOR]}%}%# %{${reset_color}%}' |
||||
|
||||
RPS1='${return_code} %D - %*' |
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[magenta]%}^%{$reset_color%}%{$fg_bold[yellow]%}" |
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" |
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} ±" |
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ?" |
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[red]%} ♥" |
||||
@ -0,0 +1,6 @@ |
||||
PROMPT='%{$fg[green]%}%~%{$fg_bold[blue]%}$(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=" ✔" |
||||
@ -0,0 +1,100 @@ |
||||
# prompt style and colors based on Steve Losh's Prose theme: |
||||
# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme |
||||
# |
||||
# vcs_info modifications from Bart Trojanowski's zsh prompt: |
||||
# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt |
||||
# |
||||
# git untracked files modification from Brian Carper: |
||||
# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt |
||||
|
||||
function virtualenv_info { |
||||
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' |
||||
} |
||||
PR_GIT_UPDATE=1 |
||||
|
||||
setopt prompt_subst |
||||
autoload colors |
||||
colors |
||||
|
||||
autoload -U add-zsh-hook |
||||
autoload -Uz vcs_info |
||||
|
||||
#use extended color pallete if available |
||||
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then |
||||
turquoise="%F{81}" |
||||
orange="%F{166}" |
||||
purple="%F{135}" |
||||
hotpink="%F{161}" |
||||
limegreen="%F{118}" |
||||
else |
||||
turquoise="$fg[cyan]" |
||||
orange="$fg[yellow]" |
||||
purple="$fg[magenta]" |
||||
hotpink="$fg[red]" |
||||
limegreen="$fg[green]" |
||||
fi |
||||
|
||||
# enable VCS systems you use |
||||
zstyle ':vcs_info:*' enable git svn |
||||
|
||||
# check-for-changes can be really slow. |
||||
# you should disable it, if you work with large repositories |
||||
zstyle ':vcs_info:*:prompt:*' check-for-changes true |
||||
|
||||
# set formats |
||||
# %b - branchname |
||||
# %u - unstagedstr (see below) |
||||
# %c - stagedstr (see below) |
||||
# %a - action (e.g. rebase-i) |
||||
# %R - repository path |
||||
# %S - path in the repository |
||||
PR_RST="%{${reset_color}%}" |
||||
FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" |
||||
FMT_ACTION="(%{$limegreen%}%a${PR_RST})" |
||||
FMT_UNSTAGED="%{$orange%}●" |
||||
FMT_STAGED="%{$limegreen%}●" |
||||
|
||||
zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}" |
||||
zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}" |
||||
zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}" |
||||
zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" |
||||
zstyle ':vcs_info:*:prompt:*' nvcsformats "" |
||||
|
||||
|
||||
function steeef_preexec { |
||||
case "$(history $HISTCMD)" in |
||||
*git*) |
||||
PR_GIT_UPDATE=1 |
||||
;; |
||||
*svn*) |
||||
PR_GIT_UPDATE=1 |
||||
;; |
||||
esac |
||||
} |
||||
add-zsh-hook preexec steeef_preexec |
||||
|
||||
function steeef_chpwd { |
||||
PR_GIT_UPDATE=1 |
||||
} |
||||
add-zsh-hook chpwd steeef_chpwd |
||||
|
||||
function steeef_precmd { |
||||
if [[ -n "$PR_GIT_UPDATE" ]] ; then |
||||
# check for untracked files or updated submodules, since vcs_info doesn't |
||||
if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then |
||||
PR_GIT_UPDATE=1 |
||||
FMT_BRANCH="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})" |
||||
else |
||||
FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" |
||||
fi |
||||
zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" |
||||
|
||||
vcs_info 'prompt' |
||||
PR_GIT_UPDATE= |
||||
fi |
||||
} |
||||
add-zsh-hook precmd steeef_precmd |
||||
|
||||
PROMPT=$' |
||||
%{$purple%}%n%{$reset_color%} at %{$orange%}%m%{$reset_color%} in %{$limegreen%}%~%{$reset_color%} $vcs_info_msg_0_ |
||||
$(virtualenv_info)$ ' |
||||
@ -0,0 +1,95 @@ |
||||
# Name: trapd00r zsh theme |
||||
# Author: Magnus Woldrich <m@japh.se> |
||||
# |
||||
# This theme needs a terminal supporting 256 colors as well as unicode. It also |
||||
# needs the script that splits up the current path and makes it fancy as located |
||||
# here: https://github.com/trapd00r/utils/blob/master/zsh_path |
||||
# |
||||
# By default it spans over two lines like so: |
||||
# |
||||
# scp1@shiva:pts/9-> /home » scp1 (0) |
||||
# > |
||||
# |
||||
# that's user@host:pts/-> splitted path (return status) |
||||
# |
||||
# If the current directory is a git repository, we span 3 lines; |
||||
# |
||||
# git❨ master ❩ DIRTY |
||||
# scp1@shiva:pts/4-> /home » scp1 » dev » utils (0) |
||||
# > |
||||
|
||||
autoload -U add-zsh-hook |
||||
autoload -Uz vcs_info |
||||
|
||||
local c0=$( printf "\e[m") |
||||
local c1=$( printf "\e[38;5;245m") |
||||
local c2=$( printf "\e[38;5;250m") |
||||
local c3=$( printf "\e[38;5;242m") |
||||
local c4=$( printf "\e[38;5;197m") |
||||
local c5=$( printf "\e[38;5;225m") |
||||
local c6=$( printf "\e[38;5;240m") |
||||
local c7=$( printf "\e[38;5;242m") |
||||
local c8=$( printf "\e[38;5;244m") |
||||
local c9=$( printf "\e[38;5;162m") |
||||
local c10=$(printf "\e[1m") |
||||
local c11=$(printf "\e[38;5;208m\e[1m") |
||||
local c12=$(printf "\e[38;5;142m\e[1m") |
||||
local c13=$(printf "\e[38;5;196m\e[1m") |
||||
|
||||
|
||||
# We dont want to use the extended colorset in the TTY / VC. |
||||
if [ "$TERM" = "linux" ]; then |
||||
c1=$( printf "\e[34;1m") |
||||
c2=$( printf "\e[35m") |
||||
c3=$( printf "\e[31m") |
||||
c4=$( printf "\e[31;1m") |
||||
c5=$( printf "\e[32m") |
||||
c6=$( printf "\e[32;1m") |
||||
c7=$( printf "\e[33m") |
||||
c8=$( printf "\e[33;1m") |
||||
c9=$( printf "\e[34m") |
||||
|
||||
c11=$(printf "\e[35;1m") |
||||
c12=$(printf "\e[36m") |
||||
c13=$(printf "\e[31;1m") |
||||
fi |
||||
|
||||
zstyle ':vcs_info:*' actionformats \ |
||||
'%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' |
||||
|
||||
zstyle ':vcs_info:*' formats \ |
||||
"%{$c8%}%s%%{$c7%}❨ %{$c9%}%{$c11%}%b%{$c7%} ❩%{$reset_color%}%f " |
||||
|
||||
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' |
||||
zstyle ':vcs_info:*' enable git |
||||
|
||||
add-zsh-hook precmd prompt_jnrowe_precmd |
||||
|
||||
prompt_jnrowe_precmd () { |
||||
vcs_info |
||||
if [ "${vcs_info_msg_0_}" = "" ]; then |
||||
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" |
||||
PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} |
||||
> ' |
||||
|
||||
# modified, to be commited |
||||
elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then |
||||
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" |
||||
PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%} |
||||
%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} |
||||
> ' |
||||
|
||||
elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then |
||||
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" |
||||
PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%} |
||||
%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} |
||||
%{$c13%}>%{$c0%} ' |
||||
else |
||||
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" |
||||
PROMPT='${vcs_info_msg_0_} |
||||
%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} |
||||
> ' |
||||
fi |
||||
} |
||||
|
||||
# vim: set ft=zsh sw=2 et tw=0: |
||||
Loading…
Reference in new issue