mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
Merge remote-tracking branch 'upstream/master'
Conflicts: README.textile lib/aliases.zsh plugins/repo/repo.plugin.zsh templates/zshrc.zsh-template themes/ys.zsh-theme
This commit is contained in:
commit
24f2838f0b
54 changed files with 1539 additions and 178 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -1,9 +1,9 @@
|
|||
locals.zsh
|
||||
log/.zsh_history
|
||||
projects.zsh
|
||||
-custom/*
|
||||
-!custom/example
|
||||
-!custom/example.zsh
|
||||
custom/*
|
||||
!custom/example
|
||||
!custom/example.zsh
|
||||
*.swp
|
||||
*.un~
|
||||
cache/
|
||||
|
|
|
|||
|
|
@ -69,11 +69,11 @@ You can install this via the command line with either `curl` or `wget`.
|
|||
|
||||
h4. via `curl`
|
||||
|
||||
@curl -L https://github.com/stibbons/oh-my-zsh/raw/master/tools/install.sh | sh@
|
||||
@curl -L https://raw.github.com/stibbons/oh-my-zsh/master/tools/install.sh | sh@
|
||||
|
||||
h4. via `wget`
|
||||
|
||||
@wget --no-check-certificate https://github.com/stibbons/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
|
||||
@wget --no-check-certificate https://raw.github.com/stibbons/oh-my-zsh/master/tools/install.sh -O - | sh@
|
||||
|
||||
h3. The manual way
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,18 @@ alias please='sudo'
|
|||
#alias g='grep -in'
|
||||
|
||||
# Show history
|
||||
alias history='fc -l 1'
|
||||
if [ "$HIST_STAMPS" = "mm/dd/yyyy" ]
|
||||
then
|
||||
alias history='fc -fl 1'
|
||||
elif [ "$HIST_STAMPS" = "dd.mm.yyyy" ]
|
||||
then
|
||||
alias history='fc -El 1'
|
||||
elif [ "$HIST_STAMPS" = "yyyy-mm-dd" ]
|
||||
then
|
||||
alias history='fc -il 1'
|
||||
else
|
||||
alias history='fc -l 1'
|
||||
fi
|
||||
|
||||
# Enable ls colors
|
||||
LS_OPTIONS='-hF'
|
||||
|
|
|
|||
10
lib/bzr.zsh
Normal file
10
lib/bzr.zsh
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
## Bazaar integration
|
||||
## Just works with the GIT integration just add $(bzr_prompt_info) to the PROMPT
|
||||
function bzr_prompt_info() {
|
||||
BZR_CB=`bzr nick 2> /dev/null | grep -v "ERROR" | cut -d ":" -f2 | awk -F / '{print "bzr::"$1}'`
|
||||
if [ -n "$BZR_CB" ]; then
|
||||
BZR_DIRTY=""
|
||||
[[ -n `bzr status` ]] && BZR_DIRTY=" %{$fg[red]%} * %{$fg[green]%}"
|
||||
echo "$ZSH_THEME_SCM_PROMPT_PREFIX$BZR_CB$BZR_DIRTY$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
fi
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
autoload -U edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey '\C-x\C-e' edit-command-line
|
||||
|
|
@ -15,3 +15,61 @@ function take() {
|
|||
cd $1
|
||||
}
|
||||
|
||||
#
|
||||
# Get the value of an alias.
|
||||
#
|
||||
# Arguments:
|
||||
# 1. alias - The alias to get its value from
|
||||
# STDOUT:
|
||||
# The value of alias $1 (if it has one).
|
||||
# Return value:
|
||||
# 0 if the alias was found,
|
||||
# 1 if it does not exist
|
||||
#
|
||||
function alias_value() {
|
||||
alias "$1" | sed "s/^$1='\(.*\)'$/\1/"
|
||||
test $(alias "$1")
|
||||
}
|
||||
|
||||
#
|
||||
# Try to get the value of an alias,
|
||||
# otherwise return the input.
|
||||
#
|
||||
# Arguments:
|
||||
# 1. alias - The alias to get its value from
|
||||
# STDOUT:
|
||||
# The value of alias $1, or $1 if there is no alias $1.
|
||||
# Return value:
|
||||
# Always 0
|
||||
#
|
||||
function try_alias_value() {
|
||||
alias_value "$1" || echo "$1"
|
||||
}
|
||||
|
||||
#
|
||||
# Set variable "$1" to default value "$2" if "$1" is not yet defined.
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The variable to set
|
||||
# 2. val - The default value
|
||||
# Return value:
|
||||
# 0 if the variable exists, 3 if it was set
|
||||
#
|
||||
function default() {
|
||||
test `typeset +m "$1"` && return 0
|
||||
typeset -g "$1"="$2" && return 3
|
||||
}
|
||||
|
||||
#
|
||||
# Set enviroment variable "$1" to default value "$2" if "$1" is not yet defined.
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The env variable to set
|
||||
# 2. val - The default value
|
||||
# Return value:
|
||||
# 0 if the env variable exists, 3 if it was set
|
||||
#
|
||||
function env_default() {
|
||||
env | grep -q "^$1=" && return 0
|
||||
export "$1=$2" && return 3
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
# get the name of the branch we are on
|
||||
function git_prompt_info() {
|
||||
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(command 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"
|
||||
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
|
||||
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(command 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"
|
||||
fi
|
||||
}
|
||||
|
||||
# Get the number of lines changed between the index and the working tree
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@ bindkey "^[[3~" delete-char
|
|||
bindkey "^[3;5~" delete-char
|
||||
bindkey "\e[3~" delete-char
|
||||
|
||||
# Edit the current command line in $EDITOR
|
||||
autoload -U edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey '\C-x\C-e' edit-command-line
|
||||
|
||||
# consider emacs keybindings:
|
||||
|
||||
#bindkey -e ## emacs key bindings
|
||||
|
|
|
|||
9
lib/nvm.zsh
Normal file
9
lib/nvm.zsh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# get the node.js version
|
||||
function nvm_prompt_info() {
|
||||
[ -f $HOME/.nvm/nvm.sh ] || return
|
||||
local nvm_prompt
|
||||
nvm_prompt=$(node -v 2>/dev/null)
|
||||
[[ "${nvm_prompt}x" == "x" ]] && return
|
||||
nvm_prompt=${nvm_prompt:1}
|
||||
echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${ZSH_THEME_NVM_PROMPT_SUFFIX}"
|
||||
}
|
||||
|
|
@ -26,3 +26,10 @@ function spectrum_ls() {
|
|||
done
|
||||
}
|
||||
|
||||
# Show all 256 colors where the background is set to specific color
|
||||
function spectrum_bls() {
|
||||
for code in {000..255}; do
|
||||
((cc = code + 1))
|
||||
print -P -- "$BG[$code]$code: Test %{$reset_color%}"
|
||||
done
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,4 +79,14 @@ elif [[ $(uname) == "Linux" ]] ; then
|
|||
echo "∞"
|
||||
fi
|
||||
}
|
||||
else
|
||||
# Empty functions so we don't cause errors in prompts
|
||||
function battery_pct_remaining() {
|
||||
}
|
||||
|
||||
function battery_time_remaining() {
|
||||
}
|
||||
|
||||
function battery_pct_prompt() {
|
||||
}
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ _1st_arguments=(
|
|||
'list:list files in a formula or not-installed formulae'
|
||||
'log:git commit log for a formula'
|
||||
'missing:check all installed formuale for missing dependencies.'
|
||||
'options:display install options specific to formula.'
|
||||
'outdated:list formulas for which a newer version is available'
|
||||
'prune:remove dead links'
|
||||
'reinstall:reinstall a formula'
|
||||
|
|
|
|||
|
|
@ -4,13 +4,36 @@ alias bp="bundle package"
|
|||
alias bo="bundle open"
|
||||
alias bu="bundle update"
|
||||
|
||||
|
||||
# The following is based on https://github.com/gma/bundler-exec
|
||||
|
||||
bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard jekyll kitchen knife middleman nanoc rackup rainbows rake rspec ruby shotgun spec spin spork strainer tailor taps thin thor unicorn unicorn_rails puma)
|
||||
|
||||
# Remove $UNBUNDLED_COMMANDS from the bundled_commands list
|
||||
for cmd in $UNBUNDLED_COMMANDS; do
|
||||
bundled_commands=(${bundled_commands#$cmd});
|
||||
done
|
||||
|
||||
## Functions
|
||||
|
||||
bi() {
|
||||
if _bundler-installed && _within-bundled-project; then
|
||||
local bundler_version=`bundle version | cut -d' ' -f3`
|
||||
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
|
||||
if [[ "$(uname)" == 'Darwin' ]]
|
||||
then
|
||||
local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
|
||||
else
|
||||
local cores_num="$(nproc)"
|
||||
fi
|
||||
bundle install --jobs=$cores_num $@
|
||||
else
|
||||
bundle install $@
|
||||
fi
|
||||
else
|
||||
echo "Can't 'bundle install' outside a bundled project"
|
||||
fi
|
||||
}
|
||||
|
||||
_bundler-installed() {
|
||||
which bundle > /dev/null 2>&1
|
||||
}
|
||||
|
|
@ -32,28 +55,14 @@ _run-with-bundler() {
|
|||
fi
|
||||
}
|
||||
|
||||
if _bundler-installed; then
|
||||
bundler_version=`bundle version | cut -d' ' -f3`
|
||||
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
|
||||
if [[ "$(uname)" == 'Darwin' ]]
|
||||
then
|
||||
local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
|
||||
else
|
||||
local cores_num="$(nproc)"
|
||||
fi
|
||||
eval "alias bi='bundle install --jobs=$cores_num'"
|
||||
else
|
||||
alias bi='bundle install'
|
||||
fi
|
||||
## Main program
|
||||
for cmd in $bundled_commands; do
|
||||
eval "function unbundled_$cmd () { $cmd \$@ }"
|
||||
eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}"
|
||||
alias $cmd=bundled_$cmd
|
||||
|
||||
## Main program
|
||||
for cmd in $bundled_commands; do
|
||||
eval "function unbundled_$cmd () { $cmd \$@ }"
|
||||
eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}"
|
||||
alias $cmd=bundled_$cmd
|
||||
if which _$cmd > /dev/null 2>&1; then
|
||||
compdef _$cmd bundled_$cmd=$cmd
|
||||
fi
|
||||
done
|
||||
|
||||
if which _$cmd > /dev/null 2>&1; then
|
||||
compdef _$cmd bundled_$cmd=$cmd
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# Authors:
|
||||
# https://github.com/AlexBio
|
||||
# https://github.com/dbb
|
||||
# https://github.com/Mappleconfusers
|
||||
#
|
||||
# Debian-related zsh aliases and functions for zsh
|
||||
|
||||
|
|
@ -56,7 +57,7 @@ if [[ $use_sudo -eq 1 ]]; then
|
|||
alias ar='sudo $apt_pref remove'
|
||||
|
||||
# apt-get only
|
||||
alias ads='sudo $apt_pref dselect-upgrade'
|
||||
alias ads='sudo apt-get dselect-upgrade'
|
||||
|
||||
# Install all .deb files in the current directory.
|
||||
# Warning: you will need to put the glob in single quotes if you use:
|
||||
|
|
@ -109,6 +110,38 @@ else
|
|||
?not(~n`uname -r`))'\'' root'
|
||||
fi
|
||||
|
||||
# Completion ################################################################
|
||||
|
||||
#
|
||||
# Registers a compdef for $1 that calls $apt_pref with the commands $2
|
||||
# To do that it creates a new completion function called _apt_pref_$2
|
||||
#
|
||||
apt_pref_compdef() {
|
||||
local f fb
|
||||
f="_apt_pref_${2}"
|
||||
|
||||
eval "function ${f}() {
|
||||
shift words;
|
||||
service=\"\$apt_pref\";
|
||||
words=(\"\$apt_pref\" '$2' \$words);
|
||||
((CURRENT++))
|
||||
test \"\${apt_pref}\" = 'aptitude' && _aptitude || _apt
|
||||
}"
|
||||
|
||||
compdef "$f" "$1"
|
||||
}
|
||||
|
||||
apt_pref_compdef aac "autoclean"
|
||||
apt_pref_compdef abd "build-dep"
|
||||
apt_pref_compdef ac "clean"
|
||||
apt_pref_compdef ad "update"
|
||||
apt_pref_compdef afu "update"
|
||||
apt_pref_compdef ag "upgrade"
|
||||
apt_pref_compdef ai "install"
|
||||
apt_pref_compdef ail "install"
|
||||
apt_pref_compdef ap "purge"
|
||||
apt_pref_compdef ar "remove"
|
||||
apt_pref_compdef ads "dselect-upgrade"
|
||||
|
||||
# Misc. #####################################################################
|
||||
# print all installed packages
|
||||
|
|
|
|||
138
plugins/fastfile/fastfile.plugin.zsh
Normal file
138
plugins/fastfile/fastfile.plugin.zsh
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
################################################################################
|
||||
# FILE: fastfile.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh plugin file.
|
||||
# AUTHOR: Michael Varner (musikmichael@web.de)
|
||||
# VERSION: 1.0.0
|
||||
#
|
||||
# This plugin adds the ability to on the fly generate and access file shortcuts.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
###########################
|
||||
# Settings
|
||||
|
||||
# These can be overwritten any time.
|
||||
# If they are not set yet, they will be
|
||||
# overwritten with their default values
|
||||
|
||||
default fastfile_dir "${HOME}/.fastfile/"
|
||||
default fastfile_var_prefix "§"
|
||||
|
||||
###########################
|
||||
# Impl
|
||||
|
||||
#
|
||||
# Generate a shortcut
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The name of the shortcut (default: name of the file)
|
||||
# 2. file - The file or directory to make the shortcut for
|
||||
# STDOUT:
|
||||
# => fastfle_print
|
||||
#
|
||||
function fastfile() {
|
||||
test "$2" || 2="."
|
||||
file=$(readlink -f "$2")
|
||||
|
||||
test "$1" || 1="$(basename "$file")"
|
||||
name=$(echo "$1" | tr " " "_")
|
||||
|
||||
|
||||
mkdir -p "${fastfile_dir}"
|
||||
echo "$file" > "$(fastfile_resolv "$name")"
|
||||
|
||||
fastfile_sync
|
||||
fastfile_print "$name"
|
||||
}
|
||||
|
||||
#
|
||||
# Resolve the location of a shortcut file (the database file, where the value is written!)
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The name of the shortcut
|
||||
# STDOUT:
|
||||
# The path
|
||||
#
|
||||
function fastfile_resolv() {
|
||||
echo "${fastfile_dir}${1}"
|
||||
}
|
||||
|
||||
#
|
||||
# Get the real path of a shortcut
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The name of the shortcut
|
||||
# STDOUT:
|
||||
# The path
|
||||
#
|
||||
function fastfile_get() {
|
||||
cat "$(fastfile_resolv "$1")"
|
||||
}
|
||||
|
||||
#
|
||||
# Print a shortcut
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The name of the shortcut
|
||||
# STDOUT:
|
||||
# Name and value of the shortcut
|
||||
#
|
||||
function fastfile_print() {
|
||||
echo "${fastfile_var_prefix}${1} -> $(fastfile_get "$1")"
|
||||
}
|
||||
|
||||
#
|
||||
# List all shortcuts
|
||||
#
|
||||
# STDOUT:
|
||||
# (=> fastfle_print) for each shortcut
|
||||
#
|
||||
function fastfile_ls() {
|
||||
for f in "${fastfile_dir}"/*; do
|
||||
file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
||||
varkey=`echo "$file" | tr " " "_"`
|
||||
|
||||
# Special format for colums
|
||||
echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
|
||||
done | column -t -s "|"
|
||||
}
|
||||
|
||||
#
|
||||
# Remove a shortcut
|
||||
#
|
||||
# Arguments:
|
||||
# 1. name - The name of the shortcut (default: name of the file)
|
||||
# 2. file - The file or directory to make the shortcut for
|
||||
# STDOUT:
|
||||
# => fastfle_print
|
||||
#
|
||||
function fastfile_rm() {
|
||||
fastfile_print "$1"
|
||||
rm "$(fastfile_resolv "$1")"
|
||||
}
|
||||
|
||||
#
|
||||
# Generate the aliases for the shortcuts
|
||||
#
|
||||
function fastfile_sync() {
|
||||
for f in "${fastfile_dir}"/*; do
|
||||
file=`basename "$f"` # To enable simpler handeling of spaces in file names
|
||||
varkey=`echo "$file" | tr " " "_"`
|
||||
|
||||
alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
|
||||
done
|
||||
}
|
||||
|
||||
##################################
|
||||
# Shortcuts
|
||||
|
||||
alias ff=fastfile
|
||||
alias ffp=fastfile_print
|
||||
alias ffrm=fastfile_rm
|
||||
alias ffls=fastfile_ls
|
||||
alias ffsync=fastfile_sync
|
||||
|
||||
##################################
|
||||
# Init
|
||||
|
||||
fastfile_sync
|
||||
|
|
@ -4,10 +4,11 @@
|
|||
# gem zsh completion, based on homebrew completion
|
||||
|
||||
_gem_installed() {
|
||||
installed_gems=(`gem list --local --no-versions`)
|
||||
installed_gems=(${(f)"$(gem list --local --no-versions)"})
|
||||
}
|
||||
|
||||
local -a _1st_arguments
|
||||
|
||||
_1st_arguments=(
|
||||
'build:Build a gem from a gemspec'
|
||||
'cert:Manage RubyGems certificates and signing settings'
|
||||
|
|
|
|||
60
plugins/git-prompt/git-prompt.plugin.zsh
Normal file
60
plugins/git-prompt/git-prompt.plugin.zsh
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
# ZSH Git Prompt Plugin from:
|
||||
# http://github.com/olivierverdier/zsh-git-prompt
|
||||
#
|
||||
export __GIT_PROMPT_DIR=$ZSH/plugins/git-prompt
|
||||
# Initialize colors.
|
||||
autoload -U colors
|
||||
colors
|
||||
|
||||
# Allow for functions in the prompt.
|
||||
setopt PROMPT_SUBST
|
||||
|
||||
## Enable auto-execution of functions.
|
||||
typeset -ga preexec_functions
|
||||
typeset -ga precmd_functions
|
||||
typeset -ga chpwd_functions
|
||||
|
||||
# Append git functions needed for prompt.
|
||||
preexec_functions+='preexec_update_git_vars'
|
||||
precmd_functions+='precmd_update_git_vars'
|
||||
chpwd_functions+='chpwd_update_git_vars'
|
||||
|
||||
## Function definitions
|
||||
function preexec_update_git_vars() {
|
||||
case "$2" in
|
||||
git*)
|
||||
__EXECUTED_GIT_COMMAND=1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function precmd_update_git_vars() {
|
||||
if [ -n "$__EXECUTED_GIT_COMMAND" ]; then
|
||||
update_current_git_vars
|
||||
unset __EXECUTED_GIT_COMMAND
|
||||
fi
|
||||
}
|
||||
|
||||
function chpwd_update_git_vars() {
|
||||
update_current_git_vars
|
||||
}
|
||||
|
||||
function update_current_git_vars() {
|
||||
unset __CURRENT_GIT_STATUS
|
||||
|
||||
local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py"
|
||||
_GIT_STATUS=`python ${gitstatus}`
|
||||
__CURRENT_GIT_STATUS=("${(f)_GIT_STATUS}")
|
||||
}
|
||||
|
||||
function prompt_git_info() {
|
||||
if [ -n "$__CURRENT_GIT_STATUS" ]; then
|
||||
echo "(%{${fg[red]}%}$__CURRENT_GIT_STATUS[1]%{${fg[default]}%}$__CURRENT_GIT_STATUS[2]%{${fg[magenta]}%}$__CURRENT_GIT_STATUS[3]%{${fg[default]}%})"
|
||||
fi
|
||||
}
|
||||
|
||||
# Set the prompt.
|
||||
#PROMPT='%B%m%~%b$(prompt_git_info) %# '
|
||||
# for a right prompt:
|
||||
#RPROMPT='%b$(prompt_git_info)'
|
||||
RPROMPT='$(prompt_git_info)'
|
||||
68
plugins/git-prompt/gitstatus.py
Normal file
68
plugins/git-prompt/gitstatus.py
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
|
||||
# change those symbols to whatever you prefer
|
||||
symbols = {'ahead of': '↑', 'behind': '↓', 'staged':'♦', 'changed':'‣', 'untracked':'…', 'clean':'⚡', 'unmerged':'≠', 'sha1':':'}
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
output,error = Popen(['git','status'], stdout=PIPE, stderr=PIPE).communicate()
|
||||
|
||||
if error:
|
||||
import sys
|
||||
sys.exit(0)
|
||||
lines = output.splitlines()
|
||||
|
||||
import re
|
||||
behead_re = re.compile(r"^# Your branch is (ahead of|behind) '(.*)' by (\d+) commit")
|
||||
diverge_re = re.compile(r"^# and have (\d+) and (\d+) different")
|
||||
|
||||
status = ''
|
||||
staged = re.compile(r'^# Changes to be committed:$', re.MULTILINE)
|
||||
changed = re.compile(r'^# Changed but not updated:$', re.MULTILINE)
|
||||
untracked = re.compile(r'^# Untracked files:$', re.MULTILINE)
|
||||
unmerged = re.compile(r'^# Unmerged paths:$', re.MULTILINE)
|
||||
|
||||
def execute(*command):
|
||||
out, err = Popen(stdout=PIPE, stderr=PIPE, *command).communicate()
|
||||
if not err:
|
||||
nb = len(out.splitlines())
|
||||
else:
|
||||
nb = '?'
|
||||
return nb
|
||||
|
||||
if staged.search(output):
|
||||
nb = execute(['git','diff','--staged','--name-only','--diff-filter=ACDMRT'])
|
||||
status += '%s%s' % (symbols['staged'], nb)
|
||||
if unmerged.search(output):
|
||||
nb = execute(['git','diff', '--staged','--name-only', '--diff-filter=U'])
|
||||
status += '%s%s' % (symbols['unmerged'], nb)
|
||||
if changed.search(output):
|
||||
nb = execute(['git','diff','--name-only', '--diff-filter=ACDMRT'])
|
||||
status += '%s%s' % (symbols['changed'], nb)
|
||||
if untracked.search(output):
|
||||
## nb = len(Popen(['git','ls-files','--others','--exclude-standard'],stdout=PIPE).communicate()[0].splitlines())
|
||||
## status += "%s" % (symbols['untracked']*(nb//3 + 1), )
|
||||
status += symbols['untracked']
|
||||
if status == '':
|
||||
status = symbols['clean']
|
||||
|
||||
remote = ''
|
||||
|
||||
bline = lines[0]
|
||||
if bline.find('Not currently on any branch') != -1:
|
||||
branch = symbols['sha1']+ Popen(['git','rev-parse','--short','HEAD'], stdout=PIPE).communicate()[0][:-1]
|
||||
else:
|
||||
branch = bline.split(' ')[3]
|
||||
bstatusline = lines[1]
|
||||
match = behead_re.match(bstatusline)
|
||||
if match:
|
||||
remote = symbols[match.groups()[0]]
|
||||
remote += match.groups()[2]
|
||||
elif lines[2:]:
|
||||
div_match = diverge_re.match(lines[2])
|
||||
if div_match:
|
||||
remote = "{behind}{1}{ahead of}{0}".format(*div_match.groups(), **symbols)
|
||||
|
||||
print '\n'.join([branch,remote,status])
|
||||
|
||||
|
|
@ -219,10 +219,19 @@ compdef _git glp=git-log
|
|||
#
|
||||
# This function return a warning if the current branch is a wip
|
||||
function work_in_progress() {
|
||||
if $(git log -n 1 | grep -q -c wip); then
|
||||
if $(git log -n 1 2>/dev/null | grep -q -c wip); then
|
||||
echo "WIP!!"
|
||||
fi
|
||||
}
|
||||
# these alias commit and uncomit wip branches
|
||||
alias gwip='git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m "wip"'
|
||||
alias gunwip='git log -n 1 | grep -q -c wip && git reset HEAD~1'
|
||||
|
||||
# these alias ignore changes to file
|
||||
alias gignore='git update-index --assume-unchanged'
|
||||
alias gunignore='git update-index --no-assume-unchanged'
|
||||
# list temporarily ignored files
|
||||
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#compdef powify
|
||||
|
||||
_powify_all_servers() {
|
||||
all_servers=(`ls $HOME/.pow/`)
|
||||
all_servers=(`ls $HOME/.pow/ 2>/dev/null`)
|
||||
}
|
||||
|
||||
local -a all_servers
|
||||
|
|
@ -30,7 +30,7 @@ fi
|
|||
|
||||
case "$words[1]" in
|
||||
server)
|
||||
_values \
|
||||
_values , \
|
||||
'install[install pow server]' \
|
||||
'reinstall[reinstall pow server]' \
|
||||
'update[update pow server]' \
|
||||
|
|
@ -45,7 +45,7 @@ case "$words[1]" in
|
|||
'config[print the current server configuration]' \
|
||||
'logs[tails the pow server logs]' ;;
|
||||
utils)
|
||||
_values \
|
||||
_values , \
|
||||
'install[install powify.dev server management tool]' \
|
||||
'reinstall[reinstall powify.dev server management tool]' \
|
||||
'uninstall[uninstall powify.dev server management tool]' ;;
|
||||
|
|
|
|||
|
|
@ -5,13 +5,24 @@
|
|||
# Don't remove this header, thank you
|
||||
# Usage: quote
|
||||
|
||||
WHO_COLOR="\e[0;33m"
|
||||
TEXT_COLOR="\e[0;35m"
|
||||
COLON_COLOR="\e[0;35m"
|
||||
END_COLOR="\e[m"
|
||||
|
||||
if [[ -x `which curl` ]]; then
|
||||
function quote()
|
||||
{
|
||||
Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php3" | grep -m 1 "dt ")
|
||||
Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php3" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ")
|
||||
TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g')
|
||||
W=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g')
|
||||
echo "\e[0;33m${W}\e[0;30m: \e[0;35m“${TXT}”\e[m"
|
||||
if [ "$W" -a "$TXT" ]; then
|
||||
echo "${WHO_COLOR}${W}${COLON_COLOR}: ${TEXT_COLOR}“${TXT}”${END_COLOR}"
|
||||
else
|
||||
quote
|
||||
fi
|
||||
}
|
||||
#quote
|
||||
else
|
||||
echo "rand-quote plugin needs curl to work" >&2
|
||||
fi
|
||||
|
|
|
|||
133
plugins/singlechar/singlechar.plugin.zsh
Normal file
133
plugins/singlechar/singlechar.plugin.zsh
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
################################################################################
|
||||
# FILE: singlechar.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh plugin file.
|
||||
# AUTHOR: Michael Varner (musikmichael@web.de)
|
||||
# VERSION: 1.0.0
|
||||
#
|
||||
# This plugin adds single char shortcuts (and combinations) for some commands.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
###########################
|
||||
# Settings
|
||||
|
||||
# These can be overwritten any time.
|
||||
# If they are not set yet, they will be
|
||||
# overwritten with their default values
|
||||
|
||||
default GREP grep
|
||||
default ROOT sudo
|
||||
default WGET wget
|
||||
default CURL curl
|
||||
|
||||
env_default PAGER less
|
||||
|
||||
###########################
|
||||
# Alias
|
||||
|
||||
# CAT, GREP, CURL, WGET
|
||||
|
||||
alias y='"$GREP" -Ri'
|
||||
alias n='"$GREP" -Rvi'
|
||||
|
||||
alias f.='find . | "$GREP"'
|
||||
alias f:='find'
|
||||
|
||||
alias f='"$GREP" -Rli'
|
||||
alias fn='"$GREP" -Rlvi'
|
||||
|
||||
alias w='echo >'
|
||||
alias a='echo >>'
|
||||
|
||||
alias c='cat'
|
||||
alias p='"$PAGER"'
|
||||
|
||||
alias m='man'
|
||||
|
||||
alias d='"$WGET"'
|
||||
alias u='"$CURL"'
|
||||
|
||||
# enhanced writing
|
||||
|
||||
alias w:='cat >'
|
||||
alias a:='cat >>'
|
||||
|
||||
# XARGS
|
||||
|
||||
alias x='xargs'
|
||||
|
||||
alias xy='xargs "$GREP" -Ri'
|
||||
alias xn='xargs "$GREP" -Riv'
|
||||
|
||||
alias xf.='xargs find | "$GREP"'
|
||||
alias xf:='xargs find'
|
||||
|
||||
alias xf='xargs "$GREP" -Rli'
|
||||
alias xfn='xargs "$GREP" -Rlvi'
|
||||
|
||||
alias xw='xargs echo >'
|
||||
alias xa='xargs echo >>'
|
||||
|
||||
alias xc='xargs cat'
|
||||
alias xp='xargs "$PAGER"'
|
||||
|
||||
alias xm='xargs man'
|
||||
|
||||
alias xd='xargs "$WGET"'
|
||||
alias xu='xargs "$CURL"'
|
||||
|
||||
alias xw:='xargs cat >'
|
||||
alias xa:='xargs >>'
|
||||
|
||||
# SUDO
|
||||
|
||||
alias s='"$ROOT"'
|
||||
|
||||
alias sy='"$ROOT" "$GREP" -Ri'
|
||||
alias sn='"$ROOT" "$GREP" -Riv'
|
||||
|
||||
alias sf.='"$ROOT" find . | "$GREP"'
|
||||
alias sf:='"$ROOT" find'
|
||||
|
||||
alias sf='"$ROOT" "$GREP" -Rli'
|
||||
alias sfn='"$ROOT" "$GREP" -Rlvi'
|
||||
|
||||
alias sw='"$ROOT" echo >'
|
||||
alias sa='"$ROOT" echo >>'
|
||||
|
||||
alias sc='"$ROOT" cat'
|
||||
alias sp='"$ROOT" "$PAGER"'
|
||||
|
||||
alias sm='"$ROOT" man'
|
||||
|
||||
alias sd='"$ROOT" "$WGET"'
|
||||
|
||||
alias sw:='"$ROOT" cat >'
|
||||
alias sa:='"$ROOT" cat >>'
|
||||
|
||||
# SUDO-XARGS
|
||||
|
||||
alias sx='"$ROOT" xargs'
|
||||
|
||||
alias sxy='"$ROOT" xargs "$GREP" -Ri'
|
||||
alias sxn='"$ROOT" xargs "$GREP" -Riv'
|
||||
|
||||
alias sxf.='"$ROOT" xargs find | "$GREP"'
|
||||
alias sxf:='"$ROOT" xargs find'
|
||||
|
||||
alias sxf='"$ROOT" xargs "$GREP" -li'
|
||||
alias sxfn='"$ROOT" xargs "$GREP" -lvi'
|
||||
|
||||
alias sxw='"$ROOT" xargs echo >'
|
||||
alias sxa='"$ROOT" xargs echo >>'
|
||||
|
||||
alias sxc='"$ROOT" xargs cat'
|
||||
alias sxp='"$ROOT" xargs "$PAGER"'
|
||||
|
||||
alias sxm='"$ROOT" xargs man'
|
||||
|
||||
alias sxd='"$ROOT" xargs "$WGET"'
|
||||
alias sxu='"$ROOT" xargs "$CURL"'
|
||||
|
||||
alias sxw:='"$ROOT" xargs cat >'
|
||||
alias sxa:='"$ROOT" xargs cat >>'
|
||||
22
plugins/sudo/sudo.zsh
Normal file
22
plugins/sudo/sudo.zsh
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# sudo will be inserted before the command
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Dongweiming <ciici123@gmail.com>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
sudo-command-line() {
|
||||
[[ -z $BUFFER ]] && zle up-history
|
||||
[[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER"
|
||||
zle end-of-line
|
||||
}
|
||||
zle -N sudo-command-line
|
||||
# Defined shortcut keys: [Esc] [Esc]
|
||||
bindkey "\e\e" sudo-command-line
|
||||
|
|
@ -7,6 +7,7 @@ _arguments \
|
|||
{--configuration,-c}"[configuration file]:FILENAME:_files" \
|
||||
{--nodaemon,-n}"[run in the foreground (same as 'nodaemon true' in config file)]" \
|
||||
{--help,-h}"[print this usage message and exit]:" \
|
||||
{--version,-v}"[print supervisord version number and exit]:" \
|
||||
{--user,-u}"[run supervisord as this user]:USER:_users" \
|
||||
{--umask,-m}"[use this umask for daemon subprocess (default is 022)]" \
|
||||
{--directory,-d}"[directory to chdir to when daemonized]" \
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ alias zpatch='sudo zypper patch' #install patches
|
|||
#Request commands
|
||||
alias zif='sudo zypper if' #display info about packages
|
||||
alias zpa='sudo zypper pa' #list packages
|
||||
alias zpatch-info='sudo zyper patch-info' #display info about patches
|
||||
alias zpattern-info='sudo zyper patch-info' #display info about patterns
|
||||
alias zproduct-info='sudo zyper patch-info' #display info about products
|
||||
alias zpatch-info='sudo zypper patch-info' #display info about patches
|
||||
alias zpattern-info='sudo zypper patch-info' #display info about patterns
|
||||
alias zproduct-info='sudo zypper patch-info' #display info about products
|
||||
alias zpch='sudo zypper pch' #list all patches
|
||||
alias zpd='sudo zypper pd' #list products
|
||||
alias zpt='sudo zypper pt' #list patterns
|
||||
|
|
|
|||
159
plugins/systemadmin/systemadmin.zsh
Normal file
159
plugins/systemadmin/systemadmin.zsh
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# This is one for the system administrator, operation and maintenance.
|
||||
# Some of which come from http://justinlilly.com/dotfiles/zsh.html
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Dongweiming <ciici123@gmail.com>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
function retval() {
|
||||
if [[ -z $1 ]];then
|
||||
echo '.'
|
||||
else
|
||||
echo $1
|
||||
fi
|
||||
}
|
||||
|
||||
function retlog() {
|
||||
if [[ -z $1 ]];then
|
||||
echo '/var/log/nginx/access.log'
|
||||
else
|
||||
echo $1
|
||||
fi
|
||||
}
|
||||
|
||||
alias ping='ping -c 5'
|
||||
alias clr='clear;echo "Currently logged in on $(tty), as $(whoami) in directory $(pwd)."'
|
||||
alias path='echo -e ${PATH//:/\\n}'
|
||||
alias mkdir='mkdir -pv'
|
||||
# get top process eating memory
|
||||
alias psmem='ps -e -orss=,args= | sort -b -k1,1n'
|
||||
alias psmem10='ps -e -orss=,args= | sort -b -k1,1n| head -10'
|
||||
# get top process eating cpu if not work try excute : export LC_ALL='C'
|
||||
alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1 -nr'
|
||||
alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1 -nr | head -10'
|
||||
# top10 of the history
|
||||
alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
|
||||
|
||||
# directory LS
|
||||
dls () {
|
||||
ls -l | grep "^d" | awk '{ print $9 }' | tr -d "/"
|
||||
}
|
||||
psgrep() {
|
||||
ps aux | grep "$(retval $1)" | grep -v grep
|
||||
}
|
||||
# Kills any process that matches a regexp passed to it
|
||||
killit() {
|
||||
ps aux | grep -v "grep" | grep "$@" | awk '{print $2}' | xargs sudo kill
|
||||
}
|
||||
|
||||
# list contents of directories in a tree-like format
|
||||
if [ -z "\${which tree}" ]; then
|
||||
tree () {
|
||||
find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
|
||||
}
|
||||
fi
|
||||
|
||||
# Sort connection state
|
||||
sortcons() {
|
||||
netstat -nat |awk '{print $6}'|sort|uniq -c|sort -rn
|
||||
}
|
||||
|
||||
# View all 80 Port Connections
|
||||
con80() {
|
||||
netstat -nat|grep -i ":80"|wc -l
|
||||
}
|
||||
|
||||
# On the connected IP sorted by the number of connections
|
||||
sortconip() {
|
||||
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
|
||||
}
|
||||
|
||||
# top20 of Find the number of requests on 80 port
|
||||
req20() {
|
||||
netstat -anlp|grep 80|grep tcp|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -n20
|
||||
}
|
||||
|
||||
# top20 of Using tcpdump port 80 access to view
|
||||
http20() {
|
||||
sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -20
|
||||
}
|
||||
|
||||
# top20 of Find time_wait connection
|
||||
timewait20() {
|
||||
netstat -n|grep TIME_WAIT|awk '{print $5}'|sort|uniq -c|sort -rn|head -n20
|
||||
}
|
||||
|
||||
# top20 of Find SYN connection
|
||||
syn20() {
|
||||
netstat -an | grep SYN | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr|head -n20
|
||||
}
|
||||
|
||||
# Printing process according to the port number
|
||||
port_pro() {
|
||||
netstat -ntlp | grep "$(retval $1)" | awk '{print $7}' | cut -d/ -f1
|
||||
}
|
||||
|
||||
# top10 of gain access to the ip address
|
||||
accessip10() {
|
||||
awk '{counts[$(11)]+=1}; END {for(url in counts) print counts[url], url}' "$(retlog)"
|
||||
}
|
||||
|
||||
# top20 of Most Visited file or page
|
||||
visitpage20() {
|
||||
awk '{print $11}' "$(retlog)"|sort|uniq -c|sort -nr|head -20
|
||||
}
|
||||
|
||||
# top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences
|
||||
consume100() {
|
||||
awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -100
|
||||
# if django website or other webiste make by no suffix language
|
||||
# awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -100
|
||||
}
|
||||
|
||||
# Website traffic statistics (G)
|
||||
webtraffic() {
|
||||
awk "{sum+=$10} END {print sum/1024/1024/1024}" "$(retlog)"
|
||||
}
|
||||
|
||||
# Statistical connections 404
|
||||
c404() {
|
||||
awk '($9 ~/404/)' "$(retlog)" | awk '{print $9,$7}' | sort
|
||||
}
|
||||
|
||||
# Statistical http status.
|
||||
httpstatus() {
|
||||
awk '{counts[$(9)]+=1}; END {for(code in counts) print code, counts[code]}' "$(retlog)"
|
||||
}
|
||||
|
||||
# Delete 0 byte file
|
||||
d0() {
|
||||
find "$(retval $1)" -type f -size 0 -exec rm -rf {} \;
|
||||
}
|
||||
|
||||
# gather external ip address
|
||||
geteip() {
|
||||
curl http://ifconfig.me
|
||||
}
|
||||
|
||||
# determine local IP address
|
||||
getip() {
|
||||
ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
|
||||
}
|
||||
|
||||
# Clear zombie processes
|
||||
clrz() {
|
||||
ps -eal | awk '{ if ($2 == "Z") {print $4}}' | kill -9
|
||||
}
|
||||
|
||||
# Second concurrent
|
||||
conssec() {
|
||||
awk '{if($9~/200|30|404/)COUNT[$4]++}END{for( a in COUNT) print a,COUNT[a]}' "$(retlog)"|sort -k 2 -nr|head -n10
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
function theme
|
||||
{
|
||||
if [ "$1" = "random" ]; then
|
||||
if [ -z "$1" ] || [ "$1" = "random" ]; then
|
||||
themes=($ZSH/themes/*zsh-theme)
|
||||
N=${#themes[@]}
|
||||
((N=(RANDOM%N)+1))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#compdef tmuxinator
|
||||
#compdef tmuxinator mux
|
||||
#autoload
|
||||
|
||||
local curcontext="$curcontext" state line ret=1
|
||||
|
|
@ -25,7 +25,7 @@ case $state in
|
|||
args)
|
||||
case $line[1] in
|
||||
start|open|copy|delete)
|
||||
_configs=(`tmuxinator list | sed -n 's/^[ \t]\+//p'`)
|
||||
_configs=(`find ~/.tmuxinator/ -name \*.yml | cut -d/ -f5 | sed s:.yml::g`)
|
||||
_values 'configs' $_configs
|
||||
ret=0
|
||||
;;
|
||||
|
|
@ -33,4 +33,4 @@ case $state in
|
|||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
return ret
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD
|
|||
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 xxd) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xshell" ) ]]; then
|
||||
function urlencode() {echo $@ | tr -d "\n" | xxd -plain | sed "s/\(..\)/%\1/g"}
|
||||
function urldecode() {printf $(echo -n $@ | sed 's/\\/\\\\/g;s/\(%\)\([0-9a-fA-F][0-9a-fA-F]\)/\\x\2/g')"\n"}
|
||||
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])"'
|
||||
|
|
@ -33,4 +36,4 @@ elif [[ $(whence perl) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHO
|
|||
fi
|
||||
fi
|
||||
|
||||
unset URLTOOLS_METHOD
|
||||
unset URLTOOLS_METHOD
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ if (( $+commands[$virtualenvwrapper] )); then
|
|||
# Check for virtualenv name override
|
||||
if [[ -f "$PROJECT_ROOT/.venv" ]]; then
|
||||
ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
|
||||
elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then
|
||||
ENV_NAME="$PROJECT_ROOT/.venv"
|
||||
elif [[ "$PROJECT_ROOT" != "." ]]; then
|
||||
ENV_NAME=`basename "$PROJECT_ROOT"`
|
||||
else
|
||||
|
|
@ -27,6 +29,8 @@ if (( $+commands[$virtualenvwrapper] )); then
|
|||
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"
|
||||
elif [[ -e "$ENV_NAME/bin/activate" ]]; then
|
||||
source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
|
||||
fi
|
||||
fi
|
||||
elif [ $CD_VIRTUAL_ENV ]; then
|
||||
|
|
|
|||
38
plugins/wd/README.md
Normal file
38
plugins/wd/README.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
## wd
|
||||
|
||||
**Maintainer:** [mfaerevaag](https://github.com/mfaerevaag)
|
||||
|
||||
`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. [Source](https://github.com/mfaerevaag/wd)
|
||||
|
||||
### Usage
|
||||
|
||||
* Add warp point to current working directory:
|
||||
|
||||
wd add test
|
||||
|
||||
If a warp point with the same name exists, use `add!` to overwrite it.
|
||||
|
||||
* From an other directory, warp to test with:
|
||||
|
||||
wd test
|
||||
|
||||
* You can warp back to previous directory, and so on, with the puncticulation syntax:
|
||||
|
||||
wd ..
|
||||
wd ...
|
||||
|
||||
This is a wrapper for the zsh `dirs` function.
|
||||
|
||||
* Remove warp point test point:
|
||||
|
||||
wd rm test
|
||||
|
||||
* List warp points to current directory (stored in `~/.warprc`):
|
||||
|
||||
wd show
|
||||
|
||||
* List all warp points (stored in `~/.warprc`):
|
||||
|
||||
wd ls
|
||||
|
||||
* Print usage with no opts or the `help` argument.
|
||||
48
plugins/wd/_wd.sh
Normal file
48
plugins/wd/_wd.sh
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#compdef wd.sh
|
||||
|
||||
zstyle ":completion:*:descriptions" format "%B%d%b"
|
||||
|
||||
CONFIG=$HOME/.warprc
|
||||
|
||||
local -a main_commands
|
||||
main_commands=(
|
||||
add:'Adds the current working directory to your warp points'
|
||||
#add'\!':'Overwrites existing warp point' # TODO: Fix
|
||||
rm:'Removes the given warp point'
|
||||
ls:'Outputs all stored warp points'
|
||||
show:'Outputs warp points to current directory'
|
||||
)
|
||||
|
||||
local -a points
|
||||
while read line
|
||||
do
|
||||
points+=$(awk "{ gsub(/\/Users\/$USER|\/home\/$USER/,\"~\"); print }" <<< $line)
|
||||
done < $CONFIG
|
||||
|
||||
_wd()
|
||||
{
|
||||
# init variables
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
# init state
|
||||
_arguments \
|
||||
'1: :->command' \
|
||||
'2: :->argument'
|
||||
|
||||
case $state in
|
||||
command)
|
||||
compadd "$@" add rm ls show
|
||||
_describe -t warp-points 'Warp points:' points && ret=0
|
||||
;;
|
||||
argument)
|
||||
case $words[2] in
|
||||
rm|add!)
|
||||
_describe -t warp-points 'warp points' points && ret=0
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
esac
|
||||
}
|
||||
|
||||
_wd "$@"
|
||||
|
|
@ -6,4 +6,4 @@
|
|||
#
|
||||
# @github.com/mfaerevaag/wd
|
||||
|
||||
alias wd='. ~/.oh-my-zsh/plugins/wd/wd.sh'
|
||||
alias wd='. $ZSH/plugins/wd/wd.sh'
|
||||
|
|
@ -19,6 +19,13 @@ RED="\033[91m"
|
|||
NOC="\033[m"
|
||||
|
||||
|
||||
# check if config file exists
|
||||
if [[ ! -a $CONFIG ]]
|
||||
then
|
||||
# if not: create config file
|
||||
touch $CONFIG
|
||||
fi
|
||||
|
||||
## load warp points
|
||||
typeset -A points
|
||||
while read line
|
||||
|
|
@ -120,11 +127,12 @@ wd_print_msg()
|
|||
|
||||
wd_print_usage()
|
||||
{
|
||||
print "Usage: wd [add|-a|--add] [rm|-r|--remove] [ls|-l|--list] <point>"
|
||||
print "Usage: wd [add|-a|--add] [rm|-r|--remove] [ls|-l|--list] <point>"
|
||||
print "\nCommands:"
|
||||
print "\t add \t Adds the current working directory to your warp points"
|
||||
print "\t add! \t Overwrites existing warp point"
|
||||
print "\t remove Removes the given warp point"
|
||||
print "\t show \t Outputs warp points to current directory"
|
||||
print "\t list \t Outputs all stored warp points"
|
||||
print "\t help \t Show this extremely helpful text"
|
||||
}
|
||||
|
|
@ -135,13 +143,20 @@ wd_print_usage()
|
|||
# get opts
|
||||
args=`getopt -o a:r:lhs -l add:,remove:,list,help,show -- $*`
|
||||
|
||||
# check if no arguments were given
|
||||
if [[ $? -ne 0 || $#* -eq 0 ]]
|
||||
then
|
||||
wd_print_usage
|
||||
else
|
||||
# can't exit, as this would exit the excecuting shell
|
||||
# e.i. your terminal
|
||||
|
||||
# check if config file is writeable
|
||||
elif [[ ! -w $CONFIG ]]
|
||||
then
|
||||
wd_print_msg $RED "\'$CONFIG\' is not writeable."
|
||||
# do nothing => exit
|
||||
# can't run `exit`, as this would exit the executing shell
|
||||
# i.e. your terminal
|
||||
|
||||
else
|
||||
#set -- $args # WTF
|
||||
|
||||
for i
|
||||
18
plugins/xcode/xcode.plugin.zsh
Normal file
18
plugins/xcode/xcode.plugin.zsh
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#xc function courtesy of http://gist.github.com/subdigital/5420709
|
||||
function xc {
|
||||
xcode_proj=`find . -name "*.xc*" -d 1 | sort -r | head -1`
|
||||
if [[ `echo -n $xcode_proj | wc -m` == 0 ]]
|
||||
then
|
||||
echo "No xcworkspace/xcodeproj file found in the current directory."
|
||||
else
|
||||
echo "Found $xcode_proj"
|
||||
open "$xcode_proj"
|
||||
fi
|
||||
}
|
||||
|
||||
function xcsel {
|
||||
sudo xcode-select --switch "$*"
|
||||
}
|
||||
|
||||
alias xcb='xcodebuild'
|
||||
alias xcp='xcode-select --print-path'
|
||||
|
|
@ -37,6 +37,11 @@ DISABLE_CORRECTION="true"
|
|||
# much faster.
|
||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
|
||||
# Uncomment following line if you want to shown in the command execution time stamp
|
||||
# in the history command output. The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|
|
||||
# yyyy-mm-dd
|
||||
# HIST_STAMPS="mm/dd/yyyy"
|
||||
|
||||
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
|
||||
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
|
||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||
|
|
@ -46,9 +51,26 @@ source $ZSH/oh-my-zsh.sh
|
|||
|
||||
zstyle ':completion:*:descriptions' format '%B%d%b'
|
||||
|
||||
# Customize to your needs...
|
||||
# User configuration
|
||||
|
||||
export PATH=$HOME/bin:/usr/local/bin:$PATH
|
||||
# export MANPATH="/usr/local/man:$MANPATH"
|
||||
|
||||
if [ -z "$LC_ALL" ]; then export LC_ALL=en_US.UTF-8; fi
|
||||
if [ -z "$LANG" ]; then export LANG=en_US.UTF-8; fi
|
||||
|
||||
# # Preferred editor for local and remote sessions
|
||||
# if [[ -n $SSH_CONNECTION ]]; then
|
||||
# export EDITOR='vim'
|
||||
# else
|
||||
# export EDITOR='mvim'
|
||||
# fi
|
||||
|
||||
# Compilation flags
|
||||
# export ARCHFLAGS="-arch x86_64"
|
||||
|
||||
# ssh
|
||||
# export SSH_KEY_PATH="~/.ssh/dsa_id"
|
||||
|
||||
if [ -e $HOME/bin ]; then export PATH="$HOME/bin:$PATH"; fi
|
||||
unsetopt correctall
|
||||
|
|
|
|||
|
|
@ -1,26 +1,121 @@
|
|||
#!/usr/bin/env zsh
|
||||
local USER_HOST='%{$terminfo[bold]$fg[yellow]%}%n@%m%{$reset_color%}'
|
||||
local RETURN_CODE="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||
local GIT_BRANCH='%{$terminfo[bold]$fg[red]%}$(git_prompt_info)%{$reset_color%}'
|
||||
local CURRENT_DIR='%{$terminfo[bold]$fg[green]%} %~%{$reset_color%}'
|
||||
local RUBY_RVM='%{$fg[gray]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
|
||||
local COMMAND_TIP='%{$terminfo[bold]$fg[blue]%}$(wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d' | sed 's/^/║/g')%{$reset_color%}'
|
||||
######### PROMPT #########
|
||||
PROMPT="%{$terminfo[bold]$fg[blue]%}╔═ %{$reset_color%}${USER_HOST} ${CURRENT_DIR} ${RUBY_RVM} ${GIT_BRANCH}
|
||||
${COMMAND_TIP}
|
||||
%{$terminfo[bold]$fg[blue]%}╚═ %{$reset_color%}%B%{$terminfo[bold]$fg[white]%}$%b%{$reset_color%} "
|
||||
RPS1='${RETURN_CODE}'
|
||||
RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}'
|
||||
######### PROMPT #########
|
||||
########## GIT ###########
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="‹"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%}›"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔"
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[082]%}✚%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[166]%}✹%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[160]%}✖%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[220]%}➜%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[082]%}═%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[190]%}✭%{$reset_color%}"
|
||||
########## GIT ###########
|
||||
# #
|
||||
# # #README
|
||||
# #
|
||||
# # This theme provides two customizable header functionalities :
|
||||
# # a) displaying a pseudo-random message from a database of quotations
|
||||
# # (https://en.wikipedia.org/wiki/Fortune_%28Unix%29)
|
||||
# # b) displaying randomly command line tips from The command line fu
|
||||
# # (http://www.commandlinefu.com) community: in order to make use of this functionality
|
||||
# # you will need Internet connection.
|
||||
# # This theme provides as well information for the current user's context, like;
|
||||
# # branch and status for the current version control system (git and svn currently
|
||||
# # supported) and time, presented to the user in a non invasive volatile way.
|
||||
# #
|
||||
# # #REQUIREMENTS
|
||||
# # This theme requires wget::
|
||||
# # -Homebrew-osx- brew install wget
|
||||
# # -Debian/Ubuntu- apt-get install wget
|
||||
# # and fortune ::
|
||||
# # -Homebrew-osx- brew install fortune
|
||||
# # -Debian/Ubuntu- apt-get install fortune
|
||||
# #
|
||||
# # optionally:
|
||||
# # -Oh-myzsh vcs plug-ins git and svn.
|
||||
# # -Solarized theme (https://github.com/altercation/solarized/)
|
||||
# # -OS X: iTerm 2 (http://www.iterm2.com/)
|
||||
# # -font Source code pro (https://github.com/adobe/source-code-pro)
|
||||
# #
|
||||
# # Author: Adolfo Benedetti
|
||||
# # email: adolfo.benedetti@gmail.com
|
||||
# # License: Public Domain
|
||||
# # This theme's look and feel is based on the Aaron Toponce's zsh theme , more info:
|
||||
# # http://pthree.org/2008/11/23/727/
|
||||
# # enjoy!
|
||||
########## COLOR ###########
|
||||
for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do
|
||||
eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
|
||||
eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
|
||||
done
|
||||
PR_RESET="%{$reset_color%}"
|
||||
RED_START="${PR_RESET}${PR_GREY}<${PR_RESET}${PR_RED}<${PR_BRIGHT_RED}<${PR_RESET} "
|
||||
RED_END="${PR_RESET}${PR_BRIGHT_RED}>${PR_RESET}${PR_RED}>${PR_GREY}>${PR_RESET} "
|
||||
GREEN_END="${PR_RESET}${PR_BRIGHT_GREEN}>${PR_RESET}${PR_GREEN}>${PR_GREY}>${PR_RESET} "
|
||||
GREEN_BASE_START="${PR_RESET}${PR_GREY}>${PR_RESET}${PR_GREEN}>${PR_BRIGHT_GREEN}>${PR_RESET}"
|
||||
GREEN_START_P1="${PR_RESET}${GREEN_BASE_START}${PR_RESET} "
|
||||
DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}"
|
||||
VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}"
|
||||
Vcs_CLEAN_COLOR="${PR_RESET}${PR_GREEN}"
|
||||
VCS_SUFIX_COLOR="${PR_RESET}${PR_RED}› ${PR_RESET}"
|
||||
# ########## COLOR ###########
|
||||
# ########## SVN ###########
|
||||
ZSH_THEME_SVN_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹svn:"
|
||||
ZSH_THEME_SVN_PROMPT_SUFFIX=""
|
||||
ZSH_THEME_SVN_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}"
|
||||
ZSH_THEME_SVN_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}"
|
||||
# ########## SVN ###########
|
||||
# ########## GIT ###########
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹git:"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}"
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="${PR_RESET}${PR_YELLOW} ✚${PR_RESET}"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="${PR_RESET}${PR_YELLOW} ✹${PR_RESET}"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="${PR_RESET}${PR_YELLOW} ✖${PR_RESET}"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="${PR_RESET}${PR_YELLOW} ➜${PR_RESET}"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="${PR_RESET}${PR_YELLOW} ═${PR_RESET}"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="${PR_RESET}${PR_YELLOW} ✭${PR_RESET}"
|
||||
# ########## GIT ###########
|
||||
function precmd {
|
||||
#gets the fortune
|
||||
ps1_fortune () {
|
||||
#Choose from all databases, regardless of whether they are considered "offensive"
|
||||
fortune -a
|
||||
}
|
||||
#obtains the tip
|
||||
ps1_command_tip () {
|
||||
wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d'
|
||||
}
|
||||
prompt_header () {
|
||||
if [[ "true" == "$ENABLE_COMMAND_TIP" ]]; then
|
||||
ps1_command_tip
|
||||
else
|
||||
ps1_fortune
|
||||
fi
|
||||
}
|
||||
PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}"
|
||||
# set a simple variable to show when in screen
|
||||
if [[ -n "${WINDOW}" ]]; then
|
||||
SCREEN=""
|
||||
fi
|
||||
}
|
||||
|
||||
# Context: user@directory or just directory
|
||||
prompt_context () {
|
||||
local user=`whoami`
|
||||
if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
|
||||
echo -n "${PR_RESET}${PR_RED}$user@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
|
||||
else
|
||||
echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
|
||||
fi
|
||||
}
|
||||
|
||||
set_prompt () {
|
||||
# required for the prompt
|
||||
setopt prompt_subst
|
||||
autoload colors zsh/terminfo
|
||||
if [[ "$terminfo[colors]" -gt 8 ]]; then
|
||||
colors
|
||||
fi
|
||||
|
||||
# ######### PROMPT #########
|
||||
PROMPT='${PROMPT_HEAD}
|
||||
${RED_START}$(prompt_context)
|
||||
${GREEN_START_P1}'
|
||||
RPROMPT='${PR_RESET}$(git_prompt_info)$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}${PR_RESET}'
|
||||
# Matching continuation prompt
|
||||
PROMPT2='${GREEN_BASE_START}${PR_RESET} %_ ${GREEN_BASE_START}${PR_RESET} '
|
||||
# ######### PROMPT #########
|
||||
}
|
||||
|
||||
set_prompt
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ eval my_gray='$FG[237]'
|
|||
eval my_orange='$FG[214]'
|
||||
|
||||
# right prompt
|
||||
RPROMPT='$my_gray%n@%m%{$reset_color%}%'
|
||||
PROMPT='$(virtualenv_prompt_info)$my_gray%n@%m%{$reset_color%}%'
|
||||
|
||||
# git settings
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075](branch:"
|
||||
|
|
|
|||
113
themes/bureau.zsh-theme
Normal file
113
themes/bureau.zsh-theme
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
# oh-my-zsh Bureau Theme
|
||||
|
||||
### NVM
|
||||
|
||||
ZSH_THEME_NVM_PROMPT_PREFIX="%B⬡%b "
|
||||
ZSH_THEME_NVM_PROMPT_SUFFIX=""
|
||||
|
||||
### Git [±master ▾●]
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="[%{$fg_bold[green]%}±%{$reset_color%}%{$fg_bold[white]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}]"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[cyan]%}▴%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg[magenta]%}▾%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg_bold[yellow]%}●%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}"
|
||||
|
||||
bureau_git_branch () {
|
||||
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
|
||||
echo "${ref#refs/heads/}"
|
||||
}
|
||||
|
||||
bureau_git_status () {
|
||||
_INDEX=$(command git status --porcelain -b 2> /dev/null)
|
||||
_STATUS=""
|
||||
if $(echo "$_INDEX" | grep '^[AMRD]. ' &> /dev/null); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
|
||||
fi
|
||||
if $(echo "$_INDEX" | grep '^.[MTD] ' &> /dev/null); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED"
|
||||
fi
|
||||
if $(echo "$_INDEX" | grep -E '^\?\? ' &> /dev/null); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED"
|
||||
fi
|
||||
if $(echo "$_INDEX" | grep '^UU ' &> /dev/null); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED"
|
||||
fi
|
||||
if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED"
|
||||
fi
|
||||
if $(echo "$_INDEX" | grep '^## .*ahead' &> /dev/null); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||
fi
|
||||
if $(echo "$_INDEX" | grep '^## .*behind' &> /dev/null); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND"
|
||||
fi
|
||||
if $(echo "$_INDEX" | grep '^## .*diverged' &> /dev/null); then
|
||||
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED"
|
||||
fi
|
||||
|
||||
echo $_STATUS
|
||||
}
|
||||
|
||||
bureau_git_prompt () {
|
||||
local _branch=$(bureau_git_branch)
|
||||
local _status=$(bureau_git_status)
|
||||
local _result=""
|
||||
if [[ "${_branch}x" != "x" ]]; then
|
||||
_result="$ZSH_THEME_GIT_PROMPT_PREFIX$_branch"
|
||||
if [[ "${_status}x" != "x" ]]; then
|
||||
_result="$_result $_status"
|
||||
fi
|
||||
_result="$_result$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
fi
|
||||
echo $_result
|
||||
}
|
||||
|
||||
|
||||
_PATH="%{$fg_bold[white]%}%~%{$reset_color%}"
|
||||
|
||||
if [[ "%#" == "#" ]]; then
|
||||
_USERNAME="%{$fg_bold[red]%}%n"
|
||||
_LIBERTY="%{$fg[red]%}#"
|
||||
else
|
||||
_USERNAME="%{$fg_bold[white]%}%n"
|
||||
_LIBERTY="%{$fg[green]%}$"
|
||||
fi
|
||||
_USERNAME="$_USERNAME%{$reset_color%}@%m"
|
||||
_LIBERTY="$_LIBERTY%{$reset_color%}"
|
||||
|
||||
|
||||
get_space () {
|
||||
local STR=$1$2
|
||||
local zero='%([BSUbfksu]|([FB]|){*})'
|
||||
local LENGTH=${#${(S%%)STR//$~zero/}}
|
||||
local SPACES=""
|
||||
(( LENGTH = ${COLUMNS} - $LENGTH - 1))
|
||||
|
||||
for i in {0..$LENGTH}
|
||||
do
|
||||
SPACES="$SPACES "
|
||||
done
|
||||
|
||||
echo $SPACES
|
||||
}
|
||||
|
||||
_1LEFT="$_USERNAME $_PATH"
|
||||
_1RIGHT="[%*] "
|
||||
|
||||
bureau_precmd () {
|
||||
_1SPACES=`get_space $_1LEFT $_1RIGHT`
|
||||
echo
|
||||
}
|
||||
|
||||
setopt prompt_subst
|
||||
PROMPT='$_1LEFT$_1SPACES$_1RIGHT
|
||||
> $_LIBERTY '
|
||||
RPROMPT='$(nvm_prompt_info) $(bureau_git_prompt)'
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook precmd bureau_precmd
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
# Fino theme by Max Masnick (http://max.masnick.me)
|
||||
|
||||
# Use with a dark background and 256-color terminal!
|
||||
# Meant for people with RVM and git. Tested only on OS X 10.7.
|
||||
# Meant for people with rbenv and git. Tested only on OS X 10.7.
|
||||
|
||||
# You can set your computer name in the ~/.box-name file if you want.
|
||||
|
||||
|
|
@ -11,34 +11,32 @@
|
|||
#
|
||||
# Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
|
||||
|
||||
function virtualenv_info {
|
||||
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
|
||||
}
|
||||
|
||||
function prompt_char {
|
||||
git branch >/dev/null 2>/dev/null && echo '±' && return
|
||||
echo '○'
|
||||
git branch >/dev/null 2>/dev/null && echo "±" && return
|
||||
echo '○'
|
||||
}
|
||||
|
||||
function box_name {
|
||||
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
|
||||
}
|
||||
|
||||
|
||||
local rvm_ruby=''
|
||||
local ruby_env=''
|
||||
if which rvm-prompt &> /dev/null; then
|
||||
rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}'
|
||||
ruby_env=' ‹$(rvm-prompt i v g)›%{$reset_color%}'
|
||||
else
|
||||
if which rbenv &> /dev/null; then
|
||||
rvm_ruby='‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
|
||||
ruby_env=' ‹$(rbenv version-name)›%{$reset_color%}'
|
||||
fi
|
||||
fi
|
||||
|
||||
local current_dir='${PWD/#$HOME/~}'
|
||||
local git_info='$(git_prompt_info)'
|
||||
local prompt_char='$(prompt_char)'
|
||||
|
||||
|
||||
PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%} ${rvm_ruby}
|
||||
╰─$(virtualenv_info)$(prompt_char) "
|
||||
PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%}${ruby_env}
|
||||
╰─${prompt_char} "
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
|
|
|
|||
|
|
@ -10,13 +10,3 @@ ZSH_THEME_GIT_PROMPT_PREFIX=$ZSH_THEME_SCM_PROMPT_PREFIX$GIT_CB
|
|||
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} "
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
## Bazaar integration
|
||||
bzr_prompt_info() {
|
||||
BZR_CB=`bzr nick 2> /dev/null | grep -v "ERROR" | cut -d ":" -f2 | awk -F / '{print "bzr::"$1}'`
|
||||
if [ -n "$BZR_CB" ]; then
|
||||
BZR_DIRTY=""
|
||||
[[ -n `bzr status` ]] && BZR_DIRTY="%{$fg[red]%} *%{$reset_color%}"
|
||||
echo "$ZSH_THEME_SCM_PROMPT_PREFIX$BZR_CB$BZR_DIRTY$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,17 +71,30 @@ setprompt () {
|
|||
|
||||
###
|
||||
# See if we can use extended characters to look nicer.
|
||||
# UTF-8 Fixed
|
||||
|
||||
typeset -A altchar
|
||||
set -A altchar ${(s..)terminfo[acsc]}
|
||||
PR_SET_CHARSET="%{$terminfo[enacs]%}"
|
||||
PR_SHIFT_IN="%{$terminfo[smacs]%}"
|
||||
PR_SHIFT_OUT="%{$terminfo[rmacs]%}"
|
||||
PR_HBAR=${altchar[q]:--}
|
||||
PR_ULCORNER=${altchar[l]:--}
|
||||
PR_LLCORNER=${altchar[m]:--}
|
||||
PR_LRCORNER=${altchar[j]:--}
|
||||
PR_URCORNER=${altchar[k]:--}
|
||||
if [[ $(locale charmap) == "UTF-8" ]]; then
|
||||
PR_SET_CHARSET=""
|
||||
PR_SHIFT_IN=""
|
||||
PR_SHIFT_OUT=""
|
||||
PR_HBAR="─"
|
||||
PR_ULCORNER="┌"
|
||||
PR_LLCORNER="└"
|
||||
PR_LRCORNER="┘"
|
||||
PR_URCORNER="┐"
|
||||
else
|
||||
typeset -A altchar
|
||||
set -A altchar ${(s..)terminfo[acsc]}
|
||||
# Some stuff to help us draw nice lines
|
||||
PR_SET_CHARSET="%{$terminfo[enacs]%}"
|
||||
PR_SHIFT_IN="%{$terminfo[smacs]%}"
|
||||
PR_SHIFT_OUT="%{$terminfo[rmacs]%}"
|
||||
PR_HBAR='$PR_SHIFT_IN${altchar[q]:--}$PR_SHIFT_OUT'
|
||||
PR_ULCORNER='$PR_SHIFT_IN${altchar[l]:--}$PR_SHIFT_OUT'
|
||||
PR_LLCORNER='$PR_SHIFT_IN${altchar[m]:--}$PR_SHIFT_OUT'
|
||||
PR_LRCORNER='$PR_SHIFT_IN${altchar[j]:--}$PR_SHIFT_OUT'
|
||||
PR_URCORNER='$PR_SHIFT_IN${altchar[k]:--}$PR_SHIFT_OUT'
|
||||
fi
|
||||
|
||||
|
||||
###
|
||||
|
|
@ -113,31 +126,31 @@ setprompt () {
|
|||
# Finally, the prompt.
|
||||
|
||||
PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
|
||||
$PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
|
||||
$PR_CYAN$PR_ULCORNER$PR_HBAR$PR_GREY(\
|
||||
$PR_GREEN%$PR_PWDLEN<...<%~%<<\
|
||||
$PR_GREY)`rvm_prompt_info || rbenv_prompt_info`$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\
|
||||
$PR_GREY)`rvm_prompt_info || rbenv_prompt_info`$PR_CYAN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_GREY(\
|
||||
$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\
|
||||
$PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\
|
||||
$PR_GREY)$PR_CYAN$PR_HBAR$PR_URCORNER\
|
||||
|
||||
$PR_CYAN$PR_SHIFT_IN$PR_LLCORNER$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\
|
||||
$PR_CYAN$PR_LLCORNER$PR_BLUE$PR_HBAR(\
|
||||
$PR_YELLOW%D{%H:%M:%S}\
|
||||
$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_SHIFT_IN$PR_HBAR\
|
||||
$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
|
||||
$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_HBAR\
|
||||
$PR_HBAR\
|
||||
>$PR_NO_COLOUR '
|
||||
|
||||
# display exitcode on the right when >0
|
||||
return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})"
|
||||
RPROMPT=' $return_code$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_BLUE$PR_HBAR$PR_SHIFT_OUT\
|
||||
($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_SHIFT_OUT$PR_NO_COLOUR'
|
||||
RPROMPT=' $return_code$PR_CYAN$PR_HBAR$PR_BLUE$PR_HBAR\
|
||||
($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_NO_COLOUR'
|
||||
|
||||
PS2='$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
|
||||
$PR_BLUE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT(\
|
||||
$PR_LIGHT_GREEN%_$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
|
||||
$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR '
|
||||
PS2='$PR_CYAN$PR_HBAR\
|
||||
$PR_BLUE$PR_HBAR(\
|
||||
$PR_LIGHT_GREEN%_$PR_BLUE)$PR_HBAR\
|
||||
$PR_CYAN$PR_HBAR$PR_NO_COLOUR '
|
||||
}
|
||||
|
||||
setprompt
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook precmd theme_precmd
|
||||
add-zsh-hook preexec theme_preexec
|
||||
add-zsh-hook preexec theme_preexec
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ function josh_prompt {
|
|||
prompt=" $prompt"
|
||||
done
|
||||
|
||||
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(git_prompt_info)"
|
||||
prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(current_branch)"
|
||||
|
||||
echo $prompt
|
||||
}
|
||||
|
|
|
|||
44
themes/peepcode.zsh-theme
Normal file
44
themes/peepcode.zsh-theme
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#
|
||||
# Based on Geoffrey Grosenbach's peepcode zsh theme from
|
||||
# https://github.com/topfunky/zsh-simple
|
||||
#
|
||||
|
||||
git_repo_path() {
|
||||
git rev-parse --git-dir 2>/dev/null
|
||||
}
|
||||
|
||||
git_commit_id() {
|
||||
git rev-parse --short HEAD 2>/dev/null
|
||||
}
|
||||
|
||||
git_mode() {
|
||||
if [[ -e "$repo_path/BISECT_LOG" ]]; then
|
||||
echo "+bisect"
|
||||
elif [[ -e "$repo_path/MERGE_HEAD" ]]; then
|
||||
echo "+merge"
|
||||
elif [[ -e "$repo_path/rebase" || -e "$repo_path/rebase-apply" || -e "$repo_path/rebase-merge" || -e "$repo_path/../.dotest" ]]; then
|
||||
echo "+rebase"
|
||||
fi
|
||||
}
|
||||
|
||||
git_dirty() {
|
||||
if [[ "$repo_path" != '.' && `git ls-files -m` != "" ]]; then
|
||||
echo " %{$fg_bold[grey]%}✗%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
|
||||
git_prompt() {
|
||||
local cb=$(current_branch)
|
||||
if [ -n "$cb" ]; then
|
||||
local repo_path=$(git_repo_path)
|
||||
echo " %{$fg_bold[grey]%}$cb %{$fg[white]%}$(git_commit_id)%{$reset_color%}$(git_mode)$(git_dirty)"
|
||||
fi
|
||||
}
|
||||
|
||||
local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})"
|
||||
|
||||
PROMPT='
|
||||
%~
|
||||
${smiley} %{$reset_color%}'
|
||||
|
||||
RPROMPT='%{$fg[white]%} $(~/.rvm/bin/rvm-prompt)$(git_prompt)%{$reset_color%}'
|
||||
128
themes/pure.zsh-theme
Normal file
128
themes/pure.zsh-theme
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# Pure - A minimal and beautiful theme for oh-my-zsh
|
||||
#
|
||||
# Based on the custom Zsh-prompt of the same name by Sindre Sorhus. A huge
|
||||
# thanks goes out to him for designing the fantastic Pure prompt in the first
|
||||
# place! I'd also like to thank Julien Nicoulaud for his "nicoulaj" theme from
|
||||
# which I've borrowed both some ideas and some actual code. You can find out
|
||||
# more about both of these fantastic two people here:
|
||||
#
|
||||
# Sindre Sorhus
|
||||
# Github: https://github.com/sindresorhus
|
||||
# Twitter: https://twitter.com/sindresorhus
|
||||
#
|
||||
# Julien Nicoulaud
|
||||
# Github: https://github.com/nicoulaj
|
||||
# Twitter: https://twitter.com/nicoulaj
|
||||
#
|
||||
# License
|
||||
#
|
||||
# Copyright (c) 2013 Kasper Kronborg Isager
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Set required options
|
||||
#
|
||||
setopt prompt_subst
|
||||
|
||||
# Load required modules
|
||||
#
|
||||
autoload -Uz vcs_info
|
||||
|
||||
# Set vcs_info parameters
|
||||
#
|
||||
zstyle ':vcs_info:*' enable hg bzr git
|
||||
zstyle ':vcs_info:*:*' unstagedstr '!'
|
||||
zstyle ':vcs_info:*:*' stagedstr '+'
|
||||
zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%%u%c"
|
||||
zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%u%c (%a)"
|
||||
zstyle ':vcs_info:*:*' nvcsformats "%~" "" ""
|
||||
|
||||
# Fastest possible way to check if repo is dirty
|
||||
#
|
||||
git_dirty() {
|
||||
# Check if we're in a git repo
|
||||
command git rev-parse --is-inside-work-tree &>/dev/null || return
|
||||
# Check if it's dirty
|
||||
command git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ] && echo "*"
|
||||
}
|
||||
|
||||
# Display information about the current repository
|
||||
#
|
||||
repo_information() {
|
||||
echo "%F{blue}${vcs_info_msg_0_%%/.} %F{8}$vcs_info_msg_1_`git_dirty` $vcs_info_msg_2_%f"
|
||||
}
|
||||
|
||||
# Displays the exec time of the last command if set threshold was exceeded
|
||||
#
|
||||
cmd_exec_time() {
|
||||
local stop=`date +%s`
|
||||
local start=${cmd_timestamp:-$stop}
|
||||
let local elapsed=$stop-$start
|
||||
[ $elapsed -gt 5 ] && echo ${elapsed}s
|
||||
}
|
||||
|
||||
# Get the intial timestamp for cmd_exec_time
|
||||
#
|
||||
preexec() {
|
||||
cmd_timestamp=`date +%s`
|
||||
}
|
||||
|
||||
# Output additional information about paths, repos and exec time
|
||||
#
|
||||
precmd() {
|
||||
vcs_info # Get version control info before we start outputting stuff
|
||||
print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f"
|
||||
}
|
||||
|
||||
# Define prompts
|
||||
#
|
||||
PROMPT="%(?.%F{magenta}.%F{red})❯%f " # Display a red prompt char on failure
|
||||
RPROMPT="%F{8}${SSH_TTY:+%n@%m}%f" # Display username if connected via SSH
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# List of vcs_info format strings:
|
||||
#
|
||||
# %b => current branch
|
||||
# %a => current action (rebase/merge)
|
||||
# %s => current version control system
|
||||
# %r => name of the root directory of the repository
|
||||
# %S => current path relative to the repository root directory
|
||||
# %m => in case of Git, show information about stashes
|
||||
# %u => show unstaged changes in the repository
|
||||
# %c => show staged changes in the repository
|
||||
#
|
||||
# List of prompt format strings:
|
||||
#
|
||||
# prompt:
|
||||
# %F => color dict
|
||||
# %f => reset color
|
||||
# %~ => current path
|
||||
# %* => time
|
||||
# %n => username
|
||||
# %m => shortname host
|
||||
# %(?..) => prompt conditional - %(condition.true.false)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
@ -1,9 +1,34 @@
|
|||
# Yay! High voltage and arrows!
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
prompt_setup_pygmalion(){
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
base_prompt='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}'
|
||||
post_prompt='%{$fg[cyan]%}⇒%{$reset_color%} '
|
||||
|
||||
base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g")
|
||||
post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g")
|
||||
|
||||
add-zsh-hook precmd prompt_pygmalion_precmd
|
||||
}
|
||||
|
||||
prompt_pygmalion_precmd(){
|
||||
local gitinfo=$(git_prompt_info)
|
||||
local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g")
|
||||
local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")"
|
||||
local prompt_length=${#exp_nocolor}
|
||||
|
||||
local nl=""
|
||||
|
||||
if [[ $prompt_length -gt 40 ]]; then
|
||||
nl=$'\n%{\r%}';
|
||||
fi
|
||||
PROMPT="$base_prompt$gitinfo$nl$post_prompt"
|
||||
}
|
||||
|
||||
prompt_setup_pygmalion
|
||||
|
||||
PROMPT='%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$reset_color%} '
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
|
||||
PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$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%}"
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}"
|
|||
function prompt_char() {
|
||||
git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return
|
||||
hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return
|
||||
darcs show repo >/dev/null 2>/dev/null && echo "%{$fg_bold[green]%}❉%{$reset_color%}" && return
|
||||
echo "%{$fg[cyan]%}◯%{$reset_color%}"
|
||||
}
|
||||
|
||||
|
|
|
|||
37
themes/sonicradish.zsh-theme
Normal file
37
themes/sonicradish.zsh-theme
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env zsh
|
||||
#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||
|
||||
setopt promptsubst
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
ROOT_ICON_COLOR=$FG[111]
|
||||
MACHINE_NAME_COLOR=$FG[208]
|
||||
PROMPT_SUCCESS_COLOR=$FG[103]
|
||||
PROMPT_FAILURE_COLOR=$FG[124]
|
||||
PROMPT_VCS_INFO_COLOR=$FG[242]
|
||||
PROMPT_PROMPT=$FG[208]
|
||||
GIT_DIRTY_COLOR=$FG[124]
|
||||
GIT_CLEAN_COLOR=$FG[148]
|
||||
GIT_PROMPT_INFO=$FG[148]
|
||||
|
||||
# Hash
|
||||
ROOT_ICON="# "
|
||||
if [[ $EUID -ne 0 ]] ; then
|
||||
ROOT_ICON=""
|
||||
fi
|
||||
|
||||
PROMPT='%{$ROOT_ICON_COLOR%}$ROOT_ICON%{$reset_color%}%{$MACHINE_NAME_COLOR%}%m➜ %{$reset_color%}%{$PROMPT_SUCCESS_COLOR%}%c%{$reset_color%} %{$GIT_PROMPT_INFO%}$(git_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ %{$reset_color%} '
|
||||
|
||||
#RPS1="${return_code}"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=": "
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%} :"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[103]%}✚%{$rset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[103]%}✹%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[103]%}✖%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[103]%}➜%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[103]%}═%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[103]%}✭%{$reset_color%}"
|
||||
|
|
@ -25,7 +25,7 @@ PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}'
|
|||
|
||||
# The right-hand prompt
|
||||
|
||||
RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}'
|
||||
RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}$(git_prompt_ahead)%{$reset_color%}'
|
||||
|
||||
# Add this at the start of RPROMPT to include rvm info showing ruby-version@gemset-name
|
||||
# %{$fg[yellow]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%}
|
||||
|
|
@ -46,6 +46,7 @@ ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ⚡" # ⓜ ⑁
|
|||
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" # ⓧ ⑂
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➜" # ⓡ ⑄
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ♒" # ⓤ ⑊
|
||||
ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[blue]%} 𝝙"
|
||||
|
||||
# More symbols to choose from:
|
||||
# ☀ ✹ ☄ ♆ ♀ ♁ ♐ ♇ ♈ ♉ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♣ ⚢ ⚲ ⚳ ⚴ ⚥ ⚤ ⚦ ⚒ ⚑ ⚐ ♺ ♻ ♼ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷
|
||||
|
|
@ -104,4 +105,4 @@ function git_time_since_commit() {
|
|||
echo "($(rvm_gemset)$COLOR~|"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,37 +3,32 @@
|
|||
# It is recommended to use with a dark background and the font Inconsolata.
|
||||
# Colors: black, red, green, yellow, *blue, magenta, cyan, and white.
|
||||
#
|
||||
# http://blog.ysmood.org/2013/03/my-ys-terminal-theme/
|
||||
# http://ysmood.org/wp/2013/03/my-ys-terminal-theme/
|
||||
# Mar 2013 ys
|
||||
|
||||
# Git Info
|
||||
# Machine name.
|
||||
function box_name {
|
||||
[ -f ~/.box-name ] && cat ~/.box-name || hostname
|
||||
}
|
||||
|
||||
# Directory info.
|
||||
local current_dir='${PWD/#$HOME/~}'
|
||||
|
||||
# Git info.
|
||||
local git_info='$(git_prompt_info)'
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[white]%}on%{$reset_color%} git:%{$fg[cyan]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}x"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}o"
|
||||
|
||||
|
||||
: <<'FORMAT'
|
||||
Prompt format:
|
||||
|
||||
PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] L:SHELL_LEVEL N:LINE_NUM
|
||||
$ COMMAND
|
||||
|
||||
For example:
|
||||
|
||||
% ys@ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] L:1 N:6
|
||||
$
|
||||
|
||||
FORMAT
|
||||
|
||||
# Prompt format: \n # USER at MACHINE in DIRECTORY on git:BRANCH STATE [TIME] \n $
|
||||
PROMPT="
|
||||
%{$terminfo[bold]$fg[blue]%}%#%{$reset_color%} \
|
||||
%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
|
||||
%{$fg[cyan]%}%n \
|
||||
%{$fg[white]%}@ \
|
||||
%{$fg[green]%}%m \
|
||||
%{$fg[white]%}at \
|
||||
%{$fg[green]%}$(box_name) \
|
||||
%{$fg[white]%}in \
|
||||
%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\
|
||||
%{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\
|
||||
${git_info} \
|
||||
%{$fg[white]%}[%*] tty:%l L:%L N:%i
|
||||
%{$fg[white]%}[%*]
|
||||
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
|
||||
|
|
|
|||
|
|
@ -1,15 +1,25 @@
|
|||
PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
autoload -U colors && colors
|
||||
|
||||
if [ -e ~/.rvm/bin/rvm-prompt ]; then
|
||||
RPROMPT='%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v g) %{$reset_color%}'
|
||||
else
|
||||
if which rbenv &> /dev/null; then
|
||||
RPROMPT='%{$reset_color%} %{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//") %{$reset_color%}'
|
||||
fi
|
||||
fi
|
||||
autoload -Uz vcs_info
|
||||
|
||||
zstyle ':vcs_info:*' stagedstr '%F{green}●'
|
||||
zstyle ':vcs_info:*' unstagedstr '%F{yellow}●'
|
||||
zstyle ':vcs_info:*' check-for-changes true
|
||||
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
|
||||
zstyle ':vcs_info:*' enable git svn
|
||||
theme_precmd () {
|
||||
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
|
||||
zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]'
|
||||
} else {
|
||||
zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}●%F{green}]'
|
||||
}
|
||||
|
||||
vcs_info
|
||||
}
|
||||
|
||||
setopt prompt_subst
|
||||
PROMPT='%B%F{blue}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}% '
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook precmd theme_precmd
|
||||
|
||||
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]%})"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
if [ -d ~/.oh-my-zsh ]
|
||||
ZSH=`/usr/bin/env|grep 'ZSH='|cut -d '=' -f 2`
|
||||
if [ -d "$ZSH" ]
|
||||
then
|
||||
echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install"
|
||||
echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove $ZSH if you want to install"
|
||||
exit
|
||||
elif [ -d ~/.oh-my-zsh ]
|
||||
then
|
||||
echo "\033[0;33mYou already have One Oh My Zsh Directory.\033[0m You'll need to remove ~/.oh-my-zsh if you want to clone"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
|
@ -21,7 +26,9 @@ echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[
|
|||
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
|
||||
|
||||
echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
|
||||
echo "export PATH=\$PATH:$PATH" >> ~/.zshrc
|
||||
sed -i -e "/export PATH=/ c\\
|
||||
export PATH=\"$PATH\"
|
||||
" ~/.zshrc
|
||||
|
||||
echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
|
||||
chsh -s `which zsh`
|
||||
|
|
@ -35,5 +42,6 @@ echo "\033[0;32m"' /____/ '"\033[0m
|
|||
echo "\033[0;32m"' (Stibbons version) '"\033[0m"
|
||||
|
||||
echo "\n\n \033[0;32m....is now installed.\033[0m"
|
||||
echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m"
|
||||
/usr/bin/env zsh
|
||||
source ~/.zshrc
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh"
|
||||
cd "$ZSH"
|
||||
if git pull --rebase origin master
|
||||
if git pull --rebase --stat origin master
|
||||
then
|
||||
printf '\033[0;32m%s\033[0m\n' ' __ __ '
|
||||
printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue