This commit is contained in:
2018-07-16 21:22:48 +02:00
commit 21427254e0
51 changed files with 3535 additions and 0 deletions

214
.zsh/.zsh/.zsh/S60_prompt Normal file
View File

@@ -0,0 +1,214 @@
#!/bin/zsh
#
# This file was written by Bart Trojanowski <bart@jukie.net>
#
# documented on my blog:
# http://www.jukie.net/~bart/blog/tag/zsh
#
# references
# http://www.zsh.org/mla/users/2006/msg01196.html
# http://dotfiles.org/~frogb/.zshrc
# http://kriener.org/articles/2009/06/04/zsh-prompt-magic
setopt prompt_subst
autoload colors
colors
autoload -Uz vcs_info
# -------------------------------
# define core prompt functions
# set some colors
for COLOR in RED GREEN BLUE YELLOW WHITE BLACK CYAN; do
eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
done
PR_RST="%{${reset_color}%}"
PR_RESET="%{%b%s%u$reset_color%}"
PR_BG="%{%(?.$PR_RESET.%S)%}"
# set formats
# %b - branchname
# %u - unstagedstr (see below)
# %c - stangedstr (see below)
# %a - action (e.g. rebase-i)
# %R - repository path
# %S - path in the repository
FMT_BRANCH="${PR_GREEN}%b%u%c${PR_RST}" # e.g. master¹²
FMT_ACTION="(${PR_CYAN}%a${PR_RST}%)" # e.g. (rebase-i)
FMT_PATH="%R${PR_YELLOW}/%S" # e.g. ~/repo/subdir
# 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
zstyle ':vcs_info:*:prompt:*' unstagedstr '¹' # display ¹ if there are unstaged changes
zstyle ':vcs_info:*:prompt:*' stagedstr '²' # display ² if there are staged changes
zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}//" "${FMT_PATH}"
zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}//" "${FMT_PATH}"
zstyle ':vcs_info:*:prompt:*' nvcsformats "" "%~"
function lprompt {
local brackets=$1
local color1=$2
local color2=$3
local bracket_open="${color1}${brackets[1]}${PR_BG}"
local bracket_close="${color1}${brackets[2]}${PR_RESET}"
local git='$vcs_info_msg_0_'
local cwd="${color2}%B%1~%b"
local vimode='${PR_VIMODE}'
local vicol='${PR_VICOLOR}'
#PROMPT="${PR_BG}${bracket_open}${git}${cwd}${bracket_close} ${vicol}${vimode}${PR_RESET} "
PROMPT="${PR_BG}${bracket_open}${git}${cwd}${bracket_close} ${vicol}${vimode}${PR_RESET} "
}
function rprompt {
local brackets=$1
local color1=$2
local color2=$3
local bracket_open="${color1}${brackets[1]}${PR_RESET}"
local bracket_close="${color1}${brackets[2]}${PR_RESET}"
local colon="${color1}:"
local at="${color1}@${PR_RESET}"
local user_host="${color2}%n${at}${color2}%m"
local vcs_cwd='${${vcs_info_msg_1_%%.}/$HOME/~}'
local cwd="${color2}%B%20<..<${vcs_cwd}%<<%b"
local inner="${user_host}${colon}${cwd}"
RPROMPT="${PR_RESET}${bracket_open}${inner}${bracket_close}${PR_RESET}"
}
# -------------------------------
# host dependent colouring
#lprompt '[]' $PR_BRIGHT_BLACK $PR_WHITE
#rprompt '()' $PR_BRIGHT_BLACK $PR_WHITE
if [ $UID -eq 0 ]; then
lprompt '<>' $PR_RED $PR_RED
rprompt '<>' $PR_RED $PR_RED
else
case $HOST in
xenon)
lprompt '[]' $PR_BRIGHT_BLACK $PR_GREEN
rprompt '()' $PR_YELLOW $PR_WHITE
;;
oxygen*)
lprompt '[]' $PR_WHITE $PR_GREEN
rprompt '()' $PR_YELLOW $PR_WHITE
;;
meson*)
lprompt '<>' $PR_RED $PR_YELLOW
rprompt '<>' $PR_RED $PR_WHITE
;;
muon*)
lprompt '<>' $PR_RED $PR_BLUE
rprompt '<>' $PR_RED $PR_WHITE
;;
quark*)
lprompt '<>' $PR_RED $PR_GREEN
rprompt '<>' $PR_RED $PR_WHITE
;;
*)
if [ "${$(hostname -f)#*.}" = "jukie.net" ]; then
lprompt '[]' $PR_BRIGHT_BLACK $PR_WHITE
rprompt '()' $PR_BRIGHT_BLACK $PR_WHITE
else
lprompt '{}' $PR_WHITE $PR_WHITE
rprompt '()' $PR_WHITE $PR_WHITE
fi
;;
esac
fi
if [ -n "$debian_chroot" ]; then
PROMPT="$bgc%{$fg[yellow]%}%B${debian_chroot}%b ${PROMPT}"
fi
# ------------------------------
# update the vcs_info_msg_ magic variables, but only as little as possible
# This variable dictates weather we are going to do the git prompt update
# before printing the next prompt. On some setups this saves 10s of work.
PR_GIT_UPDATE=1
# called before command excution
# here we decide if we should update the prompt next time
function zsh_git_prompt_preexec {
case "$(history $HISTCMD)" in
*git*)
PR_GIT_UPDATE=1
;;
esac
}
preexec_functions+='zsh_git_prompt_preexec'
# called after directory change
# we just assume that we have to update git prompt
function zsh_git_prompt_chpwd {
PR_GIT_UPDATE=1
}
chpwd_functions+='zsh_git_prompt_chpwd'
# called before prompt generation
# if needed, we will update the prompt info
function zsh_git_prompt_precmd {
if [[ -n "$PR_GIT_UPDATE" ]] ; then
vcs_info 'prompt'
PR_GIT_UPDATE=
fi
}
precmd_functions+='zsh_git_prompt_precmd'
# ------------------------------
# handle vi NORMAL/INSERT mode change
PR_VIMODE="#"
PR_VICOLOR=${PR_BLUE}
function zle-line-init zle-keymap-select {
PR_VIMODE="${${KEYMAP/vicmd/¢}/(main|viins)/$}"
PR_VICOLOR="${${KEYMAP/vicmd/${PR_RED}}/(main|viins)/${PR_GREEN}}"
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
# ------------------------------
# this stuff updates screen and xterm titles as the command runs
case $TERM in
xterm* | rxvt* | urxvt*)
function zsh_term_prompt_precmd {
print -Pn "\e]0;%n@%m: %~\a"
}
function zsh_term_prompt_preexec {
local x="${${${1//\"/\\\"}//\$/\\\\\$}//\%/%%}"
print -Pn "\e]0;%n@%m: %~ $x\a"
}
preexec_functions+='zsh_term_prompt_preexec'
precmd_functions+='zsh_term_prompt_precmd'
;;
screen*)
function zsh_term_prompt_precmd {
print -nR $'\033k'"zsh"$'\033'\\\
print -nR $'\033]0;'"zsh"$'\a'
}
function zsh_term_prompt_preexec {
local x="${${${1//\"/\\\"}//\$/\\\\\$}//\%/%%}"
print -nR $'\033k'"$x"$'\033'\\\
print -nR $'\033]0;'"$x"$'\a'
}
preexec_functions+='zsh_term_prompt_preexec'
precmd_functions+='zsh_term_prompt_precmd'
;;
esac

View File

@@ -0,0 +1,59 @@
# Super user
alias fuck='sudo $(fc -ln -1)'
#alias g='grep -in'
# List direcory contents
alias lsa='ls -lah'
alias ll='ls -l'
alias sl=ls
alias lk='ls -lSr'
alias ls='ls -c --color=auto --group-directories-first --quoting-style=shell'
alias l='ls -lcnhF --color=auto --group-directories-first --quoting-style=shell'
alias lc='ls -lcr'
alias lg='ls | grep '
alias lss='du -kh --max-depth=1 | sort -nr | more '
# alias to avoid making mistakes:
alias rm='rm -iv'
alias cp='cp -iv'
alias mv='mv -iv'
# ARCH
# pacman shortcuts:
# This one is dangerous!!
alias pacman='pacaur'
# list orphans
alias lsorphans='sudo pacman -Qqdt'
# remove orphans
alias rmorphans='sudo pacman -Rs $(pacman -Qtdq)'
# Remove the specified package(s), its configuration(s) and unneeded dependencies
alias pacrem='sudo pacman -Rns'
# list local packages with size
alias paclist="LC_ALL=C pacman -Qi | sed -n '/^Name[^:]*: \(.*\)/{s//\1 /;x};/^Installed[^:]*: \(.*\)/{s//\1/;H;x;s/\n//;p}' | sort -nk2"
alias ..="cd .."
# Dateiendungen automatisch mit dem jeweiligen Programm öffnen
alias -s html=$BROWSER
alias -s png=eog
alias -s jpg=eog
alias -s org=$BROWSER
alias -s php=$EDITOR
alias -s com=$BROWSER
alias -s net=$BROWSER
alias -s gz=tar -xzvf
alias -s bz2=tar -xjvf
alias -s java=$EDITOR
alias -s txt=$EDITOR
alias -s PKGBUILD=$EDITOR
alias -s kdbx=keepassxc
alias open="xdg-open"
alias dd='dcfldd'
alias cb='xclip -selection clipboard'
function cpstat() {
rsync -ah --progress "$1" "$2"
}

0
.zsh/.zsh/.zsh/cache Normal file
View File

View File

@@ -0,0 +1,13 @@
# fix VTE
. /etc/profile.d/vte.sh
if [ $TILIX_ID ] || [ $VTE_VERSION ]; then
source /etc/profile.d/vte.sh
fi
# fix node.js
export NVM_DIR="$HOME/.nvm"
source /usr/share/nvm/nvm.sh
source /usr/share/nvm/bash_completion
source /usr/share/nvm/install-nvm-exec

View File

@@ -0,0 +1,59 @@
if [[ -x `which git` ]]; then
alias g=git
function git-branch-name () {
git branch 2> /dev/null | grep '^\*' | sed 's/^\*\ //'
}
function git-dirty () {
git status 2> /dev/null | grep "nothing to commit (working directory clean)"
echo $?
}
function gsrb () {
branch=$(git-branch-name)
git checkout master
git svn rebase
git checkout "${branch}"
git rebase master
}
function git-need-to-push() {
if pushtime=$(git status | grep 'Your branch is ahead' 2> /dev/null); then
echo "↑ "
fi
}
function git-prompt() {
gstatus=$(git status 2> /dev/null)
branch=$(echo $gstatus | head -1 | sed 's/^# On branch //')
dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -2 | grep 'nothing to commit (working directory clean)'; echo $?)
if [[ x$branch != x ]]; then
dirty_color=$fg[green]
push_status=$(git-need-to-push)
if [[ $dirty = 1 ]] { dirty_color=$fg[red] }
[ x$branch != x ] && echo " %{$dirty_color%}$branch%{$reset_color%} $push_status"
fi
}
function git-scoreboard () {
git log | grep '^Author' | sort | uniq -ci | sort -r
}
function git-track () {
branch=$(git-branch-name)
git config branch.$branch.remote origin
git config branch.$branch.merge refs/heads/$branch
echo "tracking origin/$tracking"
}
function github-init () {
git config branch.$(git-branch-name).remote origin
git config branch.$(git-branch-name).merge refs/heads/$(git-branch-name)
}
function github-url () {
git config remote.origin.url | sed -En 's/git(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\3\/\4/p'
}
# Seems to be the best OS X jump-to-github alias from http://tinyurl.com/2mtncf
function github-go () {
open $(github-url)
}
function nhgk () {
nohup gitk --all &
}
fi

View File

@@ -0,0 +1,3 @@
function cpstat() {
rsync -ah --progress "$1" "$2"
}

View File

@@ -0,0 +1,64 @@
#!/usr/bin/env python
from __future__ import print_function
# change this symbol to whatever you prefer
prehash = ':'
from subprocess import Popen, PIPE
import sys
gitsym = Popen(['git', 'symbolic-ref', 'HEAD'], stdout=PIPE, stderr=PIPE)
branch, error = gitsym.communicate()
error_string = error.decode('utf-8')
if 'fatal: Not a git repository' in error_string:
sys.exit(0)
branch = branch.decode("utf-8").strip()[11:]
res, err = Popen(['git','diff','--name-status'], stdout=PIPE, stderr=PIPE).communicate()
err_string = err.decode('utf-8')
if 'fatal' in err_string:
sys.exit(0)
changed_files = [namestat[0] for namestat in res.decode("utf-8").splitlines()]
staged_files = [namestat[0] for namestat in Popen(['git','diff', '--staged','--name-status'], stdout=PIPE).communicate()[0].splitlines()]
nb_changed = len(changed_files) - changed_files.count('U')
nb_U = staged_files.count('U')
nb_staged = len(staged_files) - nb_U
staged = str(nb_staged)
conflicts = str(nb_U)
changed = str(nb_changed)
nb_untracked = len([0 for status in Popen(['git','status','--porcelain',],stdout=PIPE).communicate()[0].decode("utf-8").splitlines() if status.startswith('??')])
untracked = str(nb_untracked)
ahead, behind = 0,0
if not branch: # not on any branch
branch = prehash + Popen(['git','rev-parse','--short','HEAD'], stdout=PIPE).communicate()[0].decode("utf-8")[:-1]
else:
remote_name = Popen(['git','config','branch.%s.remote' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
if remote_name:
merge_name = Popen(['git','config','branch.%s.merge' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
if remote_name == '.': # local
remote_ref = merge_name
else:
remote_ref = 'refs/remotes/%s/%s' % (remote_name, merge_name[11:])
revgit = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % remote_ref],stdout=PIPE, stderr=PIPE)
revlist = revgit.communicate()[0]
if revgit.poll(): # fallback to local
revlist = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % merge_name],stdout=PIPE, stderr=PIPE).communicate()[0]
behead = revlist.decode("utf-8").splitlines()
ahead = len([x for x in behead if x[0]=='>'])
behind = len(behead) - ahead
out = ' '.join([
branch,
str(ahead),
str(behind),
staged,
conflicts,
changed,
untracked,
])
print(out, end='')

View File

@@ -0,0 +1,95 @@
# To install source this file from your .zshrc file
# Change this to reflect your installation directory
export __GIT_PROMPT_DIR=~/.zsh/git-prompt
# Initialize colors.
autoload -U colors
colors
# Allow for functions in the prompt.
setopt PROMPT_SUBST
autoload -U add-zsh-hook
add-zsh-hook chpwd chpwd_update_git_vars
add-zsh-hook preexec preexec_update_git_vars
add-zsh-hook precmd precmd_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" ] || [ -n "$ZSH_THEME_GIT_PROMPT_NOCACHE" ]; 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}")
GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
GIT_REMOTE=$__CURRENT_GIT_STATUS[2]
GIT_STAGED=$__CURRENT_GIT_STATUS[3]
GIT_CONFLICTS=$__CURRENT_GIT_STATUS[4]
GIT_CHANGED=$__CURRENT_GIT_STATUS[5]
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[6]
GIT_CLEAN=$__CURRENT_GIT_STATUS[7]
}
git_super_status() {
precmd_update_git_vars
if [ -n "$__CURRENT_GIT_STATUS" ]; then
STATUS="($GIT_BRANCH"
STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
if [ -n "$GIT_REMOTE" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_REMOTE$GIT_REMOTE%{${reset_color}%}"
fi
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
if [ "$GIT_STAGED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED$GIT_STAGED%{${reset_color}%}"
fi
if [ "$GIT_CONFLICTS" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CONFLICTS$GIT_CONFLICTS%{${reset_color}%}"
fi
if [ "$GIT_CHANGED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
fi
if [ "$GIT_UNTRACKED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}"
fi
if [ "$GIT_CLEAN" -eq "1" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
echo "$STATUS"
fi
}
# Default values for the appearance of the prompt. Configure at will.
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
ZSH_THEME_GIT_PROMPT_SEPARATOR="|"
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}●"
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}✖"
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}✚"
ZSH_THEME_GIT_PROMPT_REMOTE=""
ZSH_THEME_GIT_PROMPT_UNTRACKED="…"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✔"

View File

@@ -0,0 +1,39 @@
# TODO: Explain what some of this does..
bindkey -e
bindkey -s '^g' '|grep ""^[OD' # c g pipe to grep
bindkey '\ew' kill-region
bindkey -s '\el' "ls\n"
bindkey -s '\ek' "..\n"
bindkey -s '\ej' "cd -\n"
bindkey -s '\eh' "cd $OLDPWD\n"
bindkey -s '\e;' "pushd -1\n"
bindkey -s '\ei' "dirs\n"
bindkey -s '\eo' "popd\n"
# Meta-u to chdir to the parent directory
bindkey -s '\eu' '^Ucd ..\n'
bindkey '^r' history-incremental-search-backward
bindkey "^[[5~" up-line-or-history
bindkey "^[[6~" down-line-or-history
# make search up and down work, so partially type and hit up/down to find relevant stuff
bindkey '^[[A' up-line-or-search
bindkey '^[[B' down-line-or-search
bindkey "^[[H" beginning-of-line
bindkey "^[[1~" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[4~" end-of-line
bindkey ' ' magic-space # also do history expansion on space
bindkey '^[[Z' reverse-menu-complete
# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char
bindkey "\e[3~" delete-char
# alt+s inserts sudo at the beginning of the line
insert_sudo () { zle beginning-of-line; zle -U "sudo " }
zle -N insert-sudo insert_sudo
bindkey "^[s" insert-sudo

View File

@@ -0,0 +1,27 @@
# Git-centric variation of the "fishy" theme.
# See screenshot at http://ompldr.org/vOHcwZg
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}+"
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[magenta]%}!"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}-"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}>"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}#"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[yellow]%}?"
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX=" "
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
local user_color='green'
test $UID -eq 0 && user_color='red'
PROMPT='
%(?..%{$fg_bold[red]%}exit %?
%{$reset_color%})'\
'%{$bold_color%}$(git_prompt_status)%{$reset_color%}'\
'$(git_prompt_info)'\
'%{$fg[$user_color]%}%~%{$reset_color%}'\
'%(!.#.>) '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'

214
.zsh/.zsh/S60_prompt Normal file
View File

@@ -0,0 +1,214 @@
#!/bin/zsh
#
# This file was written by Bart Trojanowski <bart@jukie.net>
#
# documented on my blog:
# http://www.jukie.net/~bart/blog/tag/zsh
#
# references
# http://www.zsh.org/mla/users/2006/msg01196.html
# http://dotfiles.org/~frogb/.zshrc
# http://kriener.org/articles/2009/06/04/zsh-prompt-magic
setopt prompt_subst
autoload colors
colors
autoload -Uz vcs_info
# -------------------------------
# define core prompt functions
# set some colors
for COLOR in RED GREEN BLUE YELLOW WHITE BLACK CYAN; do
eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
done
PR_RST="%{${reset_color}%}"
PR_RESET="%{%b%s%u$reset_color%}"
PR_BG="%{%(?.$PR_RESET.%S)%}"
# set formats
# %b - branchname
# %u - unstagedstr (see below)
# %c - stangedstr (see below)
# %a - action (e.g. rebase-i)
# %R - repository path
# %S - path in the repository
FMT_BRANCH="${PR_GREEN}%b%u%c${PR_RST}" # e.g. master¹²
FMT_ACTION="(${PR_CYAN}%a${PR_RST}%)" # e.g. (rebase-i)
FMT_PATH="%R${PR_YELLOW}/%S" # e.g. ~/repo/subdir
# 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
zstyle ':vcs_info:*:prompt:*' unstagedstr '¹' # display ¹ if there are unstaged changes
zstyle ':vcs_info:*:prompt:*' stagedstr '²' # display ² if there are staged changes
zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}//" "${FMT_PATH}"
zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}//" "${FMT_PATH}"
zstyle ':vcs_info:*:prompt:*' nvcsformats "" "%~"
function lprompt {
local brackets=$1
local color1=$2
local color2=$3
local bracket_open="${color1}${brackets[1]}${PR_BG}"
local bracket_close="${color1}${brackets[2]}${PR_RESET}"
local git='$vcs_info_msg_0_'
local cwd="${color2}%B%1~%b"
local vimode='${PR_VIMODE}'
local vicol='${PR_VICOLOR}'
#PROMPT="${PR_BG}${bracket_open}${git}${cwd}${bracket_close} ${vicol}${vimode}${PR_RESET} "
PROMPT="${PR_BG}${bracket_open}${git}${cwd}${bracket_close} ${vicol}${vimode}${PR_RESET} "
}
function rprompt {
local brackets=$1
local color1=$2
local color2=$3
local bracket_open="${color1}${brackets[1]}${PR_RESET}"
local bracket_close="${color1}${brackets[2]}${PR_RESET}"
local colon="${color1}:"
local at="${color1}@${PR_RESET}"
local user_host="${color2}%n${at}${color2}%m"
local vcs_cwd='${${vcs_info_msg_1_%%.}/$HOME/~}'
local cwd="${color2}%B%20<..<${vcs_cwd}%<<%b"
local inner="${user_host}${colon}${cwd}"
RPROMPT="${PR_RESET}${bracket_open}${inner}${bracket_close}${PR_RESET}"
}
# -------------------------------
# host dependent colouring
#lprompt '[]' $PR_BRIGHT_BLACK $PR_WHITE
#rprompt '()' $PR_BRIGHT_BLACK $PR_WHITE
if [ $UID -eq 0 ]; then
lprompt '<>' $PR_RED $PR_RED
rprompt '<>' $PR_RED $PR_RED
else
case $HOST in
xenon)
lprompt '[]' $PR_BRIGHT_BLACK $PR_GREEN
rprompt '()' $PR_YELLOW $PR_WHITE
;;
oxygen*)
lprompt '[]' $PR_WHITE $PR_GREEN
rprompt '()' $PR_YELLOW $PR_WHITE
;;
meson*)
lprompt '<>' $PR_RED $PR_YELLOW
rprompt '<>' $PR_RED $PR_WHITE
;;
muon*)
lprompt '<>' $PR_RED $PR_BLUE
rprompt '<>' $PR_RED $PR_WHITE
;;
quark*)
lprompt '<>' $PR_RED $PR_GREEN
rprompt '<>' $PR_RED $PR_WHITE
;;
*)
if [ "${$(hostname -f)#*.}" = "jukie.net" ]; then
lprompt '[]' $PR_BRIGHT_BLACK $PR_WHITE
rprompt '()' $PR_BRIGHT_BLACK $PR_WHITE
else
lprompt '{}' $PR_WHITE $PR_WHITE
rprompt '()' $PR_WHITE $PR_WHITE
fi
;;
esac
fi
if [ -n "$debian_chroot" ]; then
PROMPT="$bgc%{$fg[yellow]%}%B${debian_chroot}%b ${PROMPT}"
fi
# ------------------------------
# update the vcs_info_msg_ magic variables, but only as little as possible
# This variable dictates weather we are going to do the git prompt update
# before printing the next prompt. On some setups this saves 10s of work.
PR_GIT_UPDATE=1
# called before command excution
# here we decide if we should update the prompt next time
function zsh_git_prompt_preexec {
case "$(history $HISTCMD)" in
*git*)
PR_GIT_UPDATE=1
;;
esac
}
preexec_functions+='zsh_git_prompt_preexec'
# called after directory change
# we just assume that we have to update git prompt
function zsh_git_prompt_chpwd {
PR_GIT_UPDATE=1
}
chpwd_functions+='zsh_git_prompt_chpwd'
# called before prompt generation
# if needed, we will update the prompt info
function zsh_git_prompt_precmd {
if [[ -n "$PR_GIT_UPDATE" ]] ; then
vcs_info 'prompt'
PR_GIT_UPDATE=
fi
}
precmd_functions+='zsh_git_prompt_precmd'
# ------------------------------
# handle vi NORMAL/INSERT mode change
PR_VIMODE="#"
PR_VICOLOR=${PR_BLUE}
function zle-line-init zle-keymap-select {
PR_VIMODE="${${KEYMAP/vicmd/¢}/(main|viins)/$}"
PR_VICOLOR="${${KEYMAP/vicmd/${PR_RED}}/(main|viins)/${PR_GREEN}}"
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
# ------------------------------
# this stuff updates screen and xterm titles as the command runs
case $TERM in
xterm* | rxvt* | urxvt*)
function zsh_term_prompt_precmd {
print -Pn "\e]0;%n@%m: %~\a"
}
function zsh_term_prompt_preexec {
local x="${${${1//\"/\\\"}//\$/\\\\\$}//\%/%%}"
print -Pn "\e]0;%n@%m: %~ $x\a"
}
preexec_functions+='zsh_term_prompt_preexec'
precmd_functions+='zsh_term_prompt_precmd'
;;
screen*)
function zsh_term_prompt_precmd {
print -nR $'\033k'"zsh"$'\033'\\\
print -nR $'\033]0;'"zsh"$'\a'
}
function zsh_term_prompt_preexec {
local x="${${${1//\"/\\\"}//\$/\\\\\$}//\%/%%}"
print -nR $'\033k'"$x"$'\033'\\\
print -nR $'\033]0;'"$x"$'\a'
}
preexec_functions+='zsh_term_prompt_preexec'
precmd_functions+='zsh_term_prompt_precmd'
;;
esac

160
.zsh/.zsh/aliases.zsh Normal file
View File

@@ -0,0 +1,160 @@
alias aliases='vim ~/.zsh/aliases.zsh'
# Push and pop directories on directory stack
alias pu='pushd'
alias po='popd'
# Super user
alias _='sudo'
alias sudo='sudo '
alias fuck='sudo $(fc -ln -1)'
#alias g='grep -in'
# List direcory contents
alias lsa='ls -lah'
alias ll='ls -l'
alias sl=ls
alias lk='ls -lSr'
alias ls='ls -c --color=auto --group-directories-first --quoting-style=shell'
alias l='ls -lcnhF --color=auto --group-directories-first --quoting-style=shell'
alias lc='ls -lcr'
alias lg='ls | grep '
alias lss='du -kh --max-depth=1 | sort -nr | more '
# alias to avoid making mistakes:
alias rm='rm -iv'
alias cp='cp -iv'
alias mv='mv -iv'
# ARCH
# pacman shortcuts:
# This one is dangerous!!
alias pacman='pacaur'
alias P="sudo pacman"
alias S="P -S"
alias Syu="P -Syu"
alias Sd="P -Ss" #search in database
alias Si="P -Qs" #search installed
# display info about pkg
#alias Si="P -Si"
# list orphans
alias lsorhpans='sudo pacman -Qqdt'
# remove orphans
alias rmorphans='sudo pacman -Rs $(pacman -Qtdq)'
# Remove the specified package(s), its configuration(s) and unneeded dependencies
alias pacrem='sudo pacman -Rns'
# list local packages with size
alias paclist="LC_ALL=C pacman -Qi | sed -n '/^Name[^:]*: \(.*\)/{s//\1 /;x};/^Installed[^:]*: \(.*\)/{s//\1/;H;x;s/\n//;p}' | sort -nk2"
# DEBIAN
# apt-get Shortcuts
alias acs='apt-cache search'
alias agi='sudo apt-get install'
alias agr='sudo apt-get remove'
alias agu='sudo apt-get update'
alias agg='sudo apt-get upgrade'
alias sources='gksudo vim /etc/apt/sources.list'
alias update='sudo apt-get update && sudo apt-get upgrade'
alias ..="cd .."
alias reboot="sudo reboot"
alias sdn="sudo shutdown -h now"
alias hibernate="sudo pm-hibernate"
# brightness workaround
alias br70='sudo setpci -s 00:02.0 F4.B=70'
alias br40='sudo setpci -s 00:02.0 F4.B=40'
alias br30='sudo setpci -s 00:02.0 F4.B=30'
alias br20='sudo setpci -s 00:02.0 F4.B=20'
alias br10='sudo setpci -s 00:02.0 F4.B=10'
alias x="exit"
# Dateiendungen automatisch mit dem jeweiligen Programm öffnen
alias -s html=$BROWSER
alias -s png=eog
alias -s jpg=eog
alias -s org=$BROWSER
alias -s php=$EDITOR
alias -s com=$BROWSER
alias -s net=$BROWSER
alias -s gz=tar -xzvf
alias -s bz2=tar -xjvf
alias -s java=$EDITOR
alias -s txt=$EDITOR
alias -s PKGBUILD=$EDITOR
alias f='find |grep'
alias c="clear"
# Krams
alias open="xdg-open"
alias pg='ps aux|grep'      # Prozess greppen -> pg name
alias h='history'
#alias du='du -kh' # lesbarer Output
alias ps='ps auxf'
alias x='exit'
alias dd='dcfldd'
alias subl='subl3'
alias reload='source ~/.zshrc'
alias xclip='xclip -selection clipboard'
# DJANGO
alias ds="django-admin runserver"
alias dp='export DJANGO_SETTINGS_MODULE=settings; export PYTHONPATH=$PWD;'
# GIT
alias ga='git add'
alias gaa='git add --all'
alias gb='git branch'
alias go='git checkout'
alias gob='git checkout -b'
alias gcl='git clone'
alias gd='git diff --ignore-space-change '
alias gdc='git diff --cached'
alias gf='git fetch '
alias gi='git init'
alias gl='git log'
alias gcm='git commit -m'
alias gc='git commit -a'
alias gme='git merge'
alias gmt="git mergetool"
alias gp='git push'
alias gpu='git pull'
alias gs='git status'
alias shit='git'
# RAILS
#bundler
alias be='bundle exec '
alias bi='bundle install '
alias bu='bundle update '
#rails 3
alias rc='rails console'
alias rs='rails server'
alias rdb='rails db'
alias rdbm='rake db:migrate'
alias rdbp='rails db:test:prepare'
alias rg='rails generate '
alias rgmi='rails generate migration '
alias rgmo='rails generate model '
alias gua='rake db:test:prepare; bundle exec guard'
alias rr='rake routes | grep'
#fuck timestamps, open last migation by vim `lastmig`
alias lastmig='echo db/migrate/`ls db/migrate -lt | head -n 2 | tail -n 1 | rev | cut -d " " -f 1 | rev`'
# APACHE
alias arc="sudo /etc/init.d/apache2 reload"
alias ars="sudo /etc/init.d/apache2 restart"
function cpstat() {
rsync -ah --progress "$1" "$2"
}

0
.zsh/.zsh/cache Normal file
View File

13
.zsh/.zsh/dev-machine.zsh Normal file
View File

@@ -0,0 +1,13 @@
# fix VTE
. /etc/profile.d/vte.sh
if [ $TILIX_ID ] || [ $VTE_VERSION ]; then
source /etc/profile.d/vte.sh
fi
# fix node.js
export NVM_DIR="$HOME/.nvm"
source /usr/share/nvm/nvm.sh
source /usr/share/nvm/bash_completion
source /usr/share/nvm/install-nvm-exec

View File

@@ -0,0 +1,59 @@
if [[ -x `which git` ]]; then
alias g=git
function git-branch-name () {
git branch 2> /dev/null | grep '^\*' | sed 's/^\*\ //'
}
function git-dirty () {
git status 2> /dev/null | grep "nothing to commit (working directory clean)"
echo $?
}
function gsrb () {
branch=$(git-branch-name)
git checkout master
git svn rebase
git checkout "${branch}"
git rebase master
}
function git-need-to-push() {
if pushtime=$(git status | grep 'Your branch is ahead' 2> /dev/null); then
echo "↑ "
fi
}
function git-prompt() {
gstatus=$(git status 2> /dev/null)
branch=$(echo $gstatus | head -1 | sed 's/^# On branch //')
dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -2 | grep 'nothing to commit (working directory clean)'; echo $?)
if [[ x$branch != x ]]; then
dirty_color=$fg[green]
push_status=$(git-need-to-push)
if [[ $dirty = 1 ]] { dirty_color=$fg[red] }
[ x$branch != x ] && echo " %{$dirty_color%}$branch%{$reset_color%} $push_status"
fi
}
function git-scoreboard () {
git log | grep '^Author' | sort | uniq -ci | sort -r
}
function git-track () {
branch=$(git-branch-name)
git config branch.$branch.remote origin
git config branch.$branch.merge refs/heads/$branch
echo "tracking origin/$tracking"
}
function github-init () {
git config branch.$(git-branch-name).remote origin
git config branch.$(git-branch-name).merge refs/heads/$(git-branch-name)
}
function github-url () {
git config remote.origin.url | sed -En 's/git(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\3\/\4/p'
}
# Seems to be the best OS X jump-to-github alias from http://tinyurl.com/2mtncf
function github-go () {
open $(github-url)
}
function nhgk () {
nohup gitk --all &
}
fi

View File

@@ -0,0 +1,3 @@
function cpstat() {
rsync -ah --progress "$1" "$2"
}

View File

@@ -0,0 +1,64 @@
#!/usr/bin/env python
from __future__ import print_function
# change this symbol to whatever you prefer
prehash = ':'
from subprocess import Popen, PIPE
import sys
gitsym = Popen(['git', 'symbolic-ref', 'HEAD'], stdout=PIPE, stderr=PIPE)
branch, error = gitsym.communicate()
error_string = error.decode('utf-8')
if 'fatal: Not a git repository' in error_string:
sys.exit(0)
branch = branch.decode("utf-8").strip()[11:]
res, err = Popen(['git','diff','--name-status'], stdout=PIPE, stderr=PIPE).communicate()
err_string = err.decode('utf-8')
if 'fatal' in err_string:
sys.exit(0)
changed_files = [namestat[0] for namestat in res.decode("utf-8").splitlines()]
staged_files = [namestat[0] for namestat in Popen(['git','diff', '--staged','--name-status'], stdout=PIPE).communicate()[0].splitlines()]
nb_changed = len(changed_files) - changed_files.count('U')
nb_U = staged_files.count('U')
nb_staged = len(staged_files) - nb_U
staged = str(nb_staged)
conflicts = str(nb_U)
changed = str(nb_changed)
nb_untracked = len([0 for status in Popen(['git','status','--porcelain',],stdout=PIPE).communicate()[0].decode("utf-8").splitlines() if status.startswith('??')])
untracked = str(nb_untracked)
ahead, behind = 0,0
if not branch: # not on any branch
branch = prehash + Popen(['git','rev-parse','--short','HEAD'], stdout=PIPE).communicate()[0].decode("utf-8")[:-1]
else:
remote_name = Popen(['git','config','branch.%s.remote' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
if remote_name:
merge_name = Popen(['git','config','branch.%s.merge' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
if remote_name == '.': # local
remote_ref = merge_name
else:
remote_ref = 'refs/remotes/%s/%s' % (remote_name, merge_name[11:])
revgit = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % remote_ref],stdout=PIPE, stderr=PIPE)
revlist = revgit.communicate()[0]
if revgit.poll(): # fallback to local
revlist = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % merge_name],stdout=PIPE, stderr=PIPE).communicate()[0]
behead = revlist.decode("utf-8").splitlines()
ahead = len([x for x in behead if x[0]=='>'])
behind = len(behead) - ahead
out = ' '.join([
branch,
str(ahead),
str(behind),
staged,
conflicts,
changed,
untracked,
])
print(out, end='')

View File

@@ -0,0 +1,95 @@
# To install source this file from your .zshrc file
# Change this to reflect your installation directory
export __GIT_PROMPT_DIR=~/.zsh/git-prompt
# Initialize colors.
autoload -U colors
colors
# Allow for functions in the prompt.
setopt PROMPT_SUBST
autoload -U add-zsh-hook
add-zsh-hook chpwd chpwd_update_git_vars
add-zsh-hook preexec preexec_update_git_vars
add-zsh-hook precmd precmd_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" ] || [ -n "$ZSH_THEME_GIT_PROMPT_NOCACHE" ]; 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}")
GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
GIT_REMOTE=$__CURRENT_GIT_STATUS[2]
GIT_STAGED=$__CURRENT_GIT_STATUS[3]
GIT_CONFLICTS=$__CURRENT_GIT_STATUS[4]
GIT_CHANGED=$__CURRENT_GIT_STATUS[5]
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[6]
GIT_CLEAN=$__CURRENT_GIT_STATUS[7]
}
git_super_status() {
precmd_update_git_vars
if [ -n "$__CURRENT_GIT_STATUS" ]; then
STATUS="($GIT_BRANCH"
STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
if [ -n "$GIT_REMOTE" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_REMOTE$GIT_REMOTE%{${reset_color}%}"
fi
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
if [ "$GIT_STAGED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED$GIT_STAGED%{${reset_color}%}"
fi
if [ "$GIT_CONFLICTS" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CONFLICTS$GIT_CONFLICTS%{${reset_color}%}"
fi
if [ "$GIT_CHANGED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
fi
if [ "$GIT_UNTRACKED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}"
fi
if [ "$GIT_CLEAN" -eq "1" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
echo "$STATUS"
fi
}
# Default values for the appearance of the prompt. Configure at will.
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
ZSH_THEME_GIT_PROMPT_SEPARATOR="|"
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}●"
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}✖"
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}✚"
ZSH_THEME_GIT_PROMPT_REMOTE=""
ZSH_THEME_GIT_PROMPT_UNTRACKED="…"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✔"

View File

@@ -0,0 +1,57 @@
# TODO: Explain what some of this does..
bindkey -e
bindkey -s '^l' "|most\n" # c l pipe to most
bindkey -s '^g' '|grep ""^[OD' # c g pipe to grep
bindkey '\ew' kill-region
bindkey -s '\el' "ls\n"
bindkey -s '\ek' "..\n"
bindkey -s '\ej' "cd -\n"
bindkey -s '\eh' "cd $OLDPWD\n"
bindkey -s '\e;' "pushd -1\n"
bindkey -s '\ei' "dirs\n"
bindkey -s '\eo' "popd\n"
# Meta-u to chdir to the parent directory
bindkey -s '\eu' '^Ucd ..\n'
bindkey '^r' history-incremental-search-backward
bindkey "^[[5~" up-line-or-history
bindkey "^[[6~" down-line-or-history
# make search up and down work, so partially type and hit up/down to find relevant stuff
bindkey '^[[A' up-line-or-search
bindkey '^[[B' down-line-or-search
bindkey "^[[H" beginning-of-line
bindkey "^[[1~" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[4~" end-of-line
bindkey ' ' magic-space # also do history expansion on space
bindkey '^[[Z' reverse-menu-complete
# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char
bindkey "\e[3~" delete-char
# alt+s inserts sudo at the beginning of the line
insert_sudo () { zle beginning-of-line; zle -U "sudo " }
zle -N insert-sudo insert_sudo
bindkey "^[s" insert-sudo
# consider emacs keybindings:
#bindkey -e ## emacs key bindings
#
#bindkey '^[[A' up-line-or-search
#bindkey '^[[B' down-line-or-search
#bindkey '^[^[[C' emacs-forward-word
#bindkey '^[^[[D' emacs-backward-word
#
#bindkey -s '^X^Z' '%-^M'
#bindkey '^[e' expand-cmd-path
#bindkey '^[^I' reverse-menu-complete
#bindkey '^X^N' accept-and-infer-next-history
#bindkey '^W' kill-region
#bindkey '^I' complete-word
## Fix weird sequence that rxvt produces
#bindkey -s '^[[Z' '\t'
#

View File

@@ -0,0 +1,27 @@
# Git-centric variation of the "fishy" theme.
# See screenshot at http://ompldr.org/vOHcwZg
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}+"
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[magenta]%}!"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}-"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}>"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}#"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[yellow]%}?"
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX=" "
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
local user_color='green'
test $UID -eq 0 && user_color='red'
PROMPT='
%(?..%{$fg_bold[red]%}exit %?
%{$reset_color%})'\
'%{$bold_color%}$(git_prompt_status)%{$reset_color%}'\
'$(git_prompt_info)'\
'%{$fg[$user_color]%}%~%{$reset_color%}'\
'%(!.#.>) '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'

214
.zsh/S60_prompt Normal file
View File

@@ -0,0 +1,214 @@
#!/bin/zsh
#
# This file was written by Bart Trojanowski <bart@jukie.net>
#
# documented on my blog:
# http://www.jukie.net/~bart/blog/tag/zsh
#
# references
# http://www.zsh.org/mla/users/2006/msg01196.html
# http://dotfiles.org/~frogb/.zshrc
# http://kriener.org/articles/2009/06/04/zsh-prompt-magic
setopt prompt_subst
autoload colors
colors
autoload -Uz vcs_info
# -------------------------------
# define core prompt functions
# set some colors
for COLOR in RED GREEN BLUE YELLOW WHITE BLACK CYAN; do
eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
done
PR_RST="%{${reset_color}%}"
PR_RESET="%{%b%s%u$reset_color%}"
PR_BG="%{%(?.$PR_RESET.%S)%}"
# set formats
# %b - branchname
# %u - unstagedstr (see below)
# %c - stangedstr (see below)
# %a - action (e.g. rebase-i)
# %R - repository path
# %S - path in the repository
FMT_BRANCH="${PR_GREEN}%b%u%c${PR_RST}" # e.g. master¹²
FMT_ACTION="(${PR_CYAN}%a${PR_RST}%)" # e.g. (rebase-i)
FMT_PATH="%R${PR_YELLOW}/%S" # e.g. ~/repo/subdir
# 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
zstyle ':vcs_info:*:prompt:*' unstagedstr '¹' # display ¹ if there are unstaged changes
zstyle ':vcs_info:*:prompt:*' stagedstr '²' # display ² if there are staged changes
zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}//" "${FMT_PATH}"
zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}//" "${FMT_PATH}"
zstyle ':vcs_info:*:prompt:*' nvcsformats "" "%~"
function lprompt {
local brackets=$1
local color1=$2
local color2=$3
local bracket_open="${color1}${brackets[1]}${PR_BG}"
local bracket_close="${color1}${brackets[2]}${PR_RESET}"
local git='$vcs_info_msg_0_'
local cwd="${color2}%B%1~%b"
local vimode='${PR_VIMODE}'
local vicol='${PR_VICOLOR}'
#PROMPT="${PR_BG}${bracket_open}${git}${cwd}${bracket_close} ${vicol}${vimode}${PR_RESET} "
PROMPT="${PR_BG}${bracket_open}${git}${cwd}${bracket_close} ${vicol}${vimode}${PR_RESET} "
}
function rprompt {
local brackets=$1
local color1=$2
local color2=$3
local bracket_open="${color1}${brackets[1]}${PR_RESET}"
local bracket_close="${color1}${brackets[2]}${PR_RESET}"
local colon="${color1}:"
local at="${color1}@${PR_RESET}"
local user_host="${color2}%n${at}${color2}%m"
local vcs_cwd='${${vcs_info_msg_1_%%.}/$HOME/~}'
local cwd="${color2}%B%20<..<${vcs_cwd}%<<%b"
local inner="${user_host}${colon}${cwd}"
RPROMPT="${PR_RESET}${bracket_open}${inner}${bracket_close}${PR_RESET}"
}
# -------------------------------
# host dependent colouring
#lprompt '[]' $PR_BRIGHT_BLACK $PR_WHITE
#rprompt '()' $PR_BRIGHT_BLACK $PR_WHITE
if [ $UID -eq 0 ]; then
lprompt '<>' $PR_RED $PR_RED
rprompt '<>' $PR_RED $PR_RED
else
case $HOST in
xenon)
lprompt '[]' $PR_BRIGHT_BLACK $PR_GREEN
rprompt '()' $PR_YELLOW $PR_WHITE
;;
oxygen*)
lprompt '[]' $PR_WHITE $PR_GREEN
rprompt '()' $PR_YELLOW $PR_WHITE
;;
meson*)
lprompt '<>' $PR_RED $PR_YELLOW
rprompt '<>' $PR_RED $PR_WHITE
;;
muon*)
lprompt '<>' $PR_RED $PR_BLUE
rprompt '<>' $PR_RED $PR_WHITE
;;
quark*)
lprompt '<>' $PR_RED $PR_GREEN
rprompt '<>' $PR_RED $PR_WHITE
;;
*)
if [ "${$(hostname -f)#*.}" = "jukie.net" ]; then
lprompt '[]' $PR_BRIGHT_BLACK $PR_WHITE
rprompt '()' $PR_BRIGHT_BLACK $PR_WHITE
else
lprompt '{}' $PR_WHITE $PR_WHITE
rprompt '()' $PR_WHITE $PR_WHITE
fi
;;
esac
fi
if [ -n "$debian_chroot" ]; then
PROMPT="$bgc%{$fg[yellow]%}%B${debian_chroot}%b ${PROMPT}"
fi
# ------------------------------
# update the vcs_info_msg_ magic variables, but only as little as possible
# This variable dictates weather we are going to do the git prompt update
# before printing the next prompt. On some setups this saves 10s of work.
PR_GIT_UPDATE=1
# called before command excution
# here we decide if we should update the prompt next time
function zsh_git_prompt_preexec {
case "$(history $HISTCMD)" in
*git*)
PR_GIT_UPDATE=1
;;
esac
}
preexec_functions+='zsh_git_prompt_preexec'
# called after directory change
# we just assume that we have to update git prompt
function zsh_git_prompt_chpwd {
PR_GIT_UPDATE=1
}
chpwd_functions+='zsh_git_prompt_chpwd'
# called before prompt generation
# if needed, we will update the prompt info
function zsh_git_prompt_precmd {
if [[ -n "$PR_GIT_UPDATE" ]] ; then
vcs_info 'prompt'
PR_GIT_UPDATE=
fi
}
precmd_functions+='zsh_git_prompt_precmd'
# ------------------------------
# handle vi NORMAL/INSERT mode change
PR_VIMODE="#"
PR_VICOLOR=${PR_BLUE}
function zle-line-init zle-keymap-select {
PR_VIMODE="${${KEYMAP/vicmd/¢}/(main|viins)/$}"
PR_VICOLOR="${${KEYMAP/vicmd/${PR_RED}}/(main|viins)/${PR_GREEN}}"
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
# ------------------------------
# this stuff updates screen and xterm titles as the command runs
case $TERM in
xterm* | rxvt* | urxvt*)
function zsh_term_prompt_precmd {
print -Pn "\e]0;%n@%m: %~\a"
}
function zsh_term_prompt_preexec {
local x="${${${1//\"/\\\"}//\$/\\\\\$}//\%/%%}"
print -Pn "\e]0;%n@%m: %~ $x\a"
}
preexec_functions+='zsh_term_prompt_preexec'
precmd_functions+='zsh_term_prompt_precmd'
;;
screen*)
function zsh_term_prompt_precmd {
print -nR $'\033k'"zsh"$'\033'\\\
print -nR $'\033]0;'"zsh"$'\a'
}
function zsh_term_prompt_preexec {
local x="${${${1//\"/\\\"}//\$/\\\\\$}//\%/%%}"
print -nR $'\033k'"$x"$'\033'\\\
print -nR $'\033]0;'"$x"$'\a'
}
preexec_functions+='zsh_term_prompt_preexec'
precmd_functions+='zsh_term_prompt_precmd'
;;
esac

159
.zsh/aliases.zsh Normal file
View File

@@ -0,0 +1,159 @@
alias aliases='vim ~/.zsh/aliases.zsh'
# Push and pop directories on directory stack
alias pu='pushd'
alias po='popd'
# Super user
alias _='sudo'
alias sudo='sudo '
alias fuck='sudo $(fc -ln -1)'
#alias g='grep -in'
# List direcory contents
alias lsa='ls -lah'
alias ll='ls -l'
alias sl=ls
alias lk='ls -lSr'
alias ls='ls -c --color=auto --group-directories-first --quoting-style=shell'
alias l='ls -lcnhF --color=auto --group-directories-first --quoting-style=shell'
alias lc='ls -lcr'
alias lg='ls | grep '
alias lss='du -kh --max-depth=1 | sort -nr | more '
# alias to avoid making mistakes:
alias rm='rm -iv'
alias cp='cp -iv'
alias mv='mv -iv'
# ARCH
# pacman shortcuts:
# This one is dangerous!!
alias pacman='pacaur'
alias P="sudo pacman"
alias S="P -S"
alias Syu="P -Syu"
alias Sd="P -Ss" #search in database
alias Si="P -Qs" #search installed
# display info about pkg
#alias Si="P -Si"
# list orphans
alias lsorhpans='sudo pacman -Qqdt'
# remove orphans
alias rmorphans='sudo pacman -Rs $(pacman -Qtdq)'
# Remove the specified package(s), its configuration(s) and unneeded dependencies
alias pacrem='sudo pacman -Rns'
# list local packages with size
alias paclist="LC_ALL=C pacman -Qi | sed -n '/^Name[^:]*: \(.*\)/{s//\1 /;x};/^Installed[^:]*: \(.*\)/{s//\1/;H;x;s/\n//;p}' | sort -nk2"
# DEBIAN
# apt-get Shortcuts
alias acs='apt-cache search'
alias agi='sudo apt-get install'
alias agr='sudo apt-get remove'
alias agu='sudo apt-get update'
alias agg='sudo apt-get upgrade'
alias sources='gksudo vim /etc/apt/sources.list'
alias update='sudo apt-get update && sudo apt-get upgrade'
alias ..="cd .."
alias reboot="sudo reboot"
alias sdn="sudo shutdown -h now"
alias hibernate="sudo pm-hibernate"
# brightness workaround
alias br70='sudo setpci -s 00:02.0 F4.B=70'
alias br40='sudo setpci -s 00:02.0 F4.B=40'
alias br30='sudo setpci -s 00:02.0 F4.B=30'
alias br20='sudo setpci -s 00:02.0 F4.B=20'
alias br10='sudo setpci -s 00:02.0 F4.B=10'
alias x="exit"
# Dateiendungen automatisch mit dem jeweiligen Programm öffnen
alias -s html=$BROWSER
alias -s png=eog
alias -s jpg=eog
alias -s org=$BROWSER
alias -s php=$EDITOR
alias -s com=$BROWSER
alias -s net=$BROWSER
alias -s gz=tar -xzvf
alias -s bz2=tar -xjvf
alias -s java=$EDITOR
alias -s txt=$EDITOR
alias -s PKGBUILD=$EDITOR
alias f='find |grep'
alias c="clear"
# Krams
alias open="xdg-open"
alias pg='ps aux|grep'      # Prozess greppen -> pg name
alias h='history'
#alias du='du -kh' # lesbarer Output
alias ps='ps auxf'
alias x='exit'
alias dd='dcfldd'
alias subl='subl3'
alias reload='source ~/.zshrc'
alias xclip='xclip -selection clipboard'
# GIT
alias ga='git add'
alias gaa='git add --all'
alias gb='git branch'
alias go='git checkout'
alias gob='git checkout -b'
alias gcl='git clone'
alias gd='git diff --ignore-space-change '
alias gdc='git diff --cached'
alias gf='git fetch '
alias gi='git init'
alias gl='git log'
alias gcm='git commit -m'
alias gc='git commit -a'
alias gme='git merge'
alias gmt="git mergetool"
alias gp='git push'
alias gpu='git pull'
alias shit='git'
alias dots='git --git-dir=$HOME/sources/dots/ --work-tree=$HOME'
# RAILS
#bundler
alias be='bundle exec '
alias bi='bundle install '
alias bu='bundle update '
#rails 3
alias rc='rails console'
alias rs='rails server'
alias rdb='rails db'
alias rdbm='rake db:migrate'
alias rdbp='rails db:test:prepare'
alias rg='rails generate '
alias rgmi='rails generate migration '
alias rgmo='rails generate model '
alias gua='rake db:test:prepare; bundle exec guard'
alias rr='rake routes | grep'
#fuck timestamps, open last migation by vim `lastmig`
alias lastmig='echo db/migrate/`ls db/migrate -lt | head -n 2 | tail -n 1 | rev | cut -d " " -f 1 | rev`'
# APACHE
alias arc="sudo /etc/init.d/apache2 reload"
alias ars="sudo /etc/init.d/apache2 restart"
function cpstat() {
rsync -ah --progress "$1" "$2"
}

0
.zsh/cache Normal file
View File

59
.zsh/functions/06_git Normal file
View File

@@ -0,0 +1,59 @@
if [[ -x `which git` ]]; then
alias g=git
function git-branch-name () {
git branch 2> /dev/null | grep '^\*' | sed 's/^\*\ //'
}
function git-dirty () {
git status 2> /dev/null | grep "nothing to commit (working directory clean)"
echo $?
}
function gsrb () {
branch=$(git-branch-name)
git checkout master
git svn rebase
git checkout "${branch}"
git rebase master
}
function git-need-to-push() {
if pushtime=$(git status | grep 'Your branch is ahead' 2> /dev/null); then
echo "↑ "
fi
}
function git-prompt() {
gstatus=$(git status 2> /dev/null)
branch=$(echo $gstatus | head -1 | sed 's/^# On branch //')
dirty=$(echo $gstatus | sed 's/^#.*$//' | tail -2 | grep 'nothing to commit (working directory clean)'; echo $?)
if [[ x$branch != x ]]; then
dirty_color=$fg[green]
push_status=$(git-need-to-push)
if [[ $dirty = 1 ]] { dirty_color=$fg[red] }
[ x$branch != x ] && echo " %{$dirty_color%}$branch%{$reset_color%} $push_status"
fi
}
function git-scoreboard () {
git log | grep '^Author' | sort | uniq -ci | sort -r
}
function git-track () {
branch=$(git-branch-name)
git config branch.$branch.remote origin
git config branch.$branch.merge refs/heads/$branch
echo "tracking origin/$tracking"
}
function github-init () {
git config branch.$(git-branch-name).remote origin
git config branch.$(git-branch-name).merge refs/heads/$(git-branch-name)
}
function github-url () {
git config remote.origin.url | sed -En 's/git(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\3\/\4/p'
}
# Seems to be the best OS X jump-to-github alias from http://tinyurl.com/2mtncf
function github-go () {
open $(github-url)
}
function nhgk () {
nohup gitk --all &
}
fi

3
.zsh/functions/07_felix Normal file
View File

@@ -0,0 +1,3 @@
function cpstat() {
rsync -ah --progress "$1" "$2"
}

View File

@@ -0,0 +1,63 @@
#!/usr/bin/env python
from __future__ import print_function
# change this symbol to whatever you prefer
prehash = ':'
from subprocess import Popen, PIPE
import sys
gitsym = Popen(['git', 'symbolic-ref', 'HEAD'], stdout=PIPE, stderr=PIPE)
branch, error = gitsym.communicate()
error_string = error.decode('utf-8')
if 'fatal: not a git repository' in error_string:
sys.exit(0)
branch = branch.decode("utf-8").strip()[11:]
res, err = Popen(['git','diff','--name-status'], stdout=PIPE, stderr=PIPE).communicate()
err_string = err.decode('utf-8')
if 'fatal' in err_string:
sys.exit(0)
changed_files = [namestat[0] for namestat in res.decode("utf-8").splitlines()]
staged_files = [namestat[0] for namestat in Popen(['git','diff', '--staged','--name-status'], stdout=PIPE).communicate()[0].splitlines()]
nb_changed = len(changed_files) - changed_files.count('U')
nb_U = staged_files.count('U')
nb_staged = len(staged_files) - nb_U
staged = str(nb_staged)
conflicts = str(nb_U)
changed = str(nb_changed)
nb_untracked = len([0 for status in Popen(['git','status','--porcelain',],stdout=PIPE).communicate()[0].decode("utf-8").splitlines() if status.startswith('??')])
untracked = str(nb_untracked)
ahead, behind = 0,0
if not branch: # not on any branch
branch = prehash + Popen(['git','rev-parse','--short','HEAD'], stdout=PIPE).communicate()[0].decode("utf-8")[:-1]
else:
remote_name = Popen(['git','config','branch.%s.remote' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
if remote_name:
merge_name = Popen(['git','config','branch.%s.merge' % branch], stdout=PIPE).communicate()[0].decode("utf-8").strip()
if remote_name == '.': # local
remote_ref = merge_name
else:
remote_ref = 'refs/remotes/%s/%s' % (remote_name, merge_name[11:])
revgit = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % remote_ref],stdout=PIPE, stderr=PIPE)
revlist = revgit.communicate()[0]
if revgit.poll(): # fallback to local
revlist = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % merge_name],stdout=PIPE, stderr=PIPE).communicate()[0]
behead = revlist.decode("utf-8").splitlines()
ahead = len([x for x in behead if x[0]=='>'])
behind = len(behead) - ahead
out = ' '.join([
branch,
str(ahead),
str(behind),
staged,
conflicts,
changed,
untracked,
])
print(out, end='')

95
.zsh/git-prompt/loader.sh Normal file
View File

@@ -0,0 +1,95 @@
# To install source this file from your .zshrc file
# Change this to reflect your installation directory
export __GIT_PROMPT_DIR=~/.zsh/git-prompt
# Initialize colors.
autoload -U colors
colors
# Allow for functions in the prompt.
setopt PROMPT_SUBST
autoload -U add-zsh-hook
add-zsh-hook chpwd chpwd_update_git_vars
add-zsh-hook preexec preexec_update_git_vars
add-zsh-hook precmd precmd_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" ] || [ -n "$ZSH_THEME_GIT_PROMPT_NOCACHE" ]; 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}")
GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
GIT_REMOTE=$__CURRENT_GIT_STATUS[2]
GIT_STAGED=$__CURRENT_GIT_STATUS[3]
GIT_CONFLICTS=$__CURRENT_GIT_STATUS[4]
GIT_CHANGED=$__CURRENT_GIT_STATUS[5]
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[6]
GIT_CLEAN=$__CURRENT_GIT_STATUS[7]
}
git_super_status() {
precmd_update_git_vars
if [ -n "$__CURRENT_GIT_STATUS" ]; then
STATUS="($GIT_BRANCH"
STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
if [ -n "$GIT_REMOTE" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_REMOTE$GIT_REMOTE%{${reset_color}%}"
fi
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
if [ "$GIT_STAGED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED$GIT_STAGED%{${reset_color}%}"
fi
if [ "$GIT_CONFLICTS" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CONFLICTS$GIT_CONFLICTS%{${reset_color}%}"
fi
if [ "$GIT_CHANGED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
fi
if [ "$GIT_UNTRACKED" -ne "0" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}"
fi
if [ "$GIT_CLEAN" -eq "1" ]; then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
echo "$STATUS"
fi
}
# Default values for the appearance of the prompt. Configure at will.
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
ZSH_THEME_GIT_PROMPT_SEPARATOR="|"
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}●"
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}✖"
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}✚"
ZSH_THEME_GIT_PROMPT_REMOTE=""
ZSH_THEME_GIT_PROMPT_UNTRACKED="…"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✔"

56
.zsh/key-bindings.zsh Normal file
View File

@@ -0,0 +1,56 @@
# TODO: Explain what some of this does..
bindkey -e
bindkey -s '^g' '|grep ""^[OD' # c g pipe to grep
bindkey '\ew' kill-region
bindkey -s '\el' "ls\n"
bindkey -s '\ek' "..\n"
bindkey -s '\ej' "cd -\n"
bindkey -s '\eh' "cd $OLDPWD\n"
bindkey -s '\e;' "pushd -1\n"
bindkey -s '\ei' "dirs\n"
bindkey -s '\eo' "popd\n"
# Meta-u to chdir to the parent directory
bindkey -s '\eu' '^Ucd ..\n'
bindkey '^r' history-incremental-search-backward
bindkey "^[[5~" up-line-or-history
bindkey "^[[6~" down-line-or-history
# make search up and down work, so partially type and hit up/down to find relevant stuff
bindkey '^[[A' up-line-or-search
bindkey '^[[B' down-line-or-search
bindkey "^[[H" beginning-of-line
bindkey "^[[1~" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[4~" end-of-line
bindkey ' ' magic-space # also do history expansion on space
bindkey '^[[Z' reverse-menu-complete
# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~
bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char
bindkey "\e[3~" delete-char
# alt+s inserts sudo at the beginning of the line
insert_sudo () { zle beginning-of-line; zle -U "sudo " }
zle -N insert-sudo insert_sudo
bindkey "^[s" insert-sudo
# consider emacs keybindings:
#bindkey -e ## emacs key bindings
#
#bindkey '^[[A' up-line-or-search
#bindkey '^[[B' down-line-or-search
#bindkey '^[^[[C' emacs-forward-word
#bindkey '^[^[[D' emacs-backward-word
#
#bindkey -s '^X^Z' '%-^M'
#bindkey '^[e' expand-cmd-path
#bindkey '^[^I' reverse-menu-complete
#bindkey '^X^N' accept-and-infer-next-history
#bindkey '^W' kill-region
#bindkey '^I' complete-word
## Fix weird sequence that rxvt produces
#bindkey -s '^[[Z' '\t'
#

27
.zsh/sunaku.zsh-theme Normal file
View File

@@ -0,0 +1,27 @@
# Git-centric variation of the "fishy" theme.
# See screenshot at http://ompldr.org/vOHcwZg
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}+"
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[magenta]%}!"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}-"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}>"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}#"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[yellow]%}?"
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX=" "
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
local user_color='green'
test $UID -eq 0 && user_color='red'
PROMPT='
%(?..%{$fg_bold[red]%}exit %?
%{$reset_color%})'\
'%{$bold_color%}$(git_prompt_status)%{$reset_color%}'\
'$(git_prompt_info)'\
'%{$fg[$user_color]%}%~%{$reset_color%}'\
'%(!.#.>) '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'