2011-01-11 02:48:06 +01:00
|
|
|
# -*- Mode: shell-script -*-
|
2010-12-05 12:50:00 +01:00
|
|
|
# Setup variables
|
|
|
|
PATH="${PATH}:/usr/local/bin:${HOME}/bin"
|
|
|
|
|
2011-02-23 21:09:36 +01:00
|
|
|
HISTFILE=~/.zsh/histfile
|
|
|
|
HISTSIZE=1000
|
|
|
|
SAVEHIST=1000
|
|
|
|
|
|
|
|
setopt notify
|
2011-05-01 16:57:43 +02:00
|
|
|
# Allow for functions in the prompt
|
|
|
|
setopt PROMPT_SUBST
|
|
|
|
setopt EXTENDED_GLOB
|
2011-02-23 21:09:36 +01:00
|
|
|
|
|
|
|
zstyle :compinstall filename '/home/slash/.zshrc'
|
|
|
|
|
|
|
|
autoload -Uz compinit
|
|
|
|
compinit
|
|
|
|
|
2010-12-05 12:50:00 +01:00
|
|
|
# Functions
|
2011-05-27 21:39:24 +02:00
|
|
|
function env()
|
|
|
|
{
|
2010-12-05 12:50:00 +01:00
|
|
|
exec /usr/bin/env "$@" | grep -v ^LESS_TERMCAP_
|
|
|
|
}
|
|
|
|
|
2011-09-23 15:49:34 +02:00
|
|
|
function line()
|
|
|
|
{
|
|
|
|
let width=`expr $COLUMNS - ${#1} - 2`
|
|
|
|
for i in {1..$width}
|
|
|
|
do
|
|
|
|
echo -n \\x2d
|
|
|
|
done
|
|
|
|
echo " $1"
|
|
|
|
}
|
|
|
|
|
2011-10-17 00:07:14 +02:00
|
|
|
function shutdown()
|
|
|
|
{
|
|
|
|
dbus-send --system --print-reply \
|
|
|
|
--dest="org.freedesktop.ConsoleKit" \
|
|
|
|
/org/freedesktop/ConsoleKit/Manager \
|
|
|
|
org.freedesktop.ConsoleKit.Manager.Stop
|
|
|
|
}
|
|
|
|
|
|
|
|
function reboot()
|
|
|
|
{
|
|
|
|
dbus-send --system --print-reply \
|
|
|
|
--dest="org.freedesktop.ConsoleKit" \
|
|
|
|
/org/freedesktop/ConsoleKit/Manager \
|
|
|
|
org.freedesktop.ConsoleKit.Manager.Restart
|
|
|
|
}
|
|
|
|
|
2010-12-05 12:50:00 +01:00
|
|
|
# Initialize colors.
|
|
|
|
autoload -U colors
|
|
|
|
colors
|
|
|
|
|
|
|
|
# Autoload zsh functions.
|
|
|
|
fpath=(~/.zsh/functions $fpath)
|
|
|
|
autoload -U ~/.zsh/functions/*(:t)
|
|
|
|
|
|
|
|
# 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'
|
2011-01-01 03:11:16 +01:00
|
|
|
chpwd_functions+='chpwd_show_todo'
|
2010-12-05 12:50:00 +01:00
|
|
|
|
|
|
|
# Set the prompt.
|
2011-11-09 19:43:34 +01:00
|
|
|
PROMPT='%{${fg[black]}%}%B$(line "$(~/.rootname.scm)")%b%{${fg[default]}%}
|
2011-09-23 15:49:34 +02:00
|
|
|
(%{${fg[magenta]}%}%m%{${fg[default]}%} %{${fg[cyan]}%}%B%~%b%{${fg[default]}%}) %(?.%{${fg[green]}%}O.%{${fg[red]}%}X)%{${fg[default]}%} %# '
|
2010-12-05 12:50:00 +01:00
|
|
|
RPROMPT='$(prompt_git_info)%{${fg[default]}%}'
|
|
|
|
|
|
|
|
# Set terminal name to current runnign application
|
|
|
|
case $TERM in
|
|
|
|
rxvt*)
|
2011-05-16 10:57:14 +02:00
|
|
|
precmd () { print -Pn "\e]0;%~\a" }
|
|
|
|
preexec () { print -Pn "\e]0;$1\a" }
|
2010-12-05 12:50:00 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Set terminal keys
|
|
|
|
bindkey "\e[1~" beginning-of-line
|
|
|
|
bindkey "\e[4~" end-of-line
|
|
|
|
bindkey "\e[5~" beginning-of-history
|
|
|
|
bindkey "\e[6~" end-of-history
|
|
|
|
bindkey "\e[3~" delete-char
|
|
|
|
bindkey "\e[2~" quoted-insert
|
|
|
|
bindkey "\e[5C" forward-word
|
|
|
|
bindkey "\e0c" emacs-forward-word
|
|
|
|
bindkey "\e[5D" backward-word
|
|
|
|
bindkey "\e0d" emacs-backward-word
|
|
|
|
bindkey "\e\e[C" forward-word
|
|
|
|
bindkey "\e\e[D" backward-word
|
|
|
|
## for rxvt
|
|
|
|
bindkey "\e[8~" end-of-line
|
|
|
|
bindkey "\e[7~" beginning-of-line
|
|
|
|
## for non RH/Debian xterm, can't hurt for RH/Debian xterm
|
|
|
|
bindkey "\e0H" beginning-of-line
|
|
|
|
bindkey "\e0F" end-of-line
|
|
|
|
## for freebsd console
|
|
|
|
bindkey "\e[H" beginning-of-line
|
|
|
|
bindkey "\e[F" end-of-line
|
2011-01-11 13:39:45 +01:00
|
|
|
|
2011-05-16 10:57:14 +02:00
|
|
|
# Show syntax highlighting when we're not running in emacs
|
2011-01-28 19:25:50 +01:00
|
|
|
if [ -z $EMACS ]; then
|
|
|
|
source ~/.zsh/syntax-highlighting/zsh-syntax-highlighting.zsh
|
|
|
|
|
|
|
|
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue'
|
|
|
|
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue'
|
|
|
|
fi
|
2011-05-16 10:57:14 +02:00
|
|
|
|
|
|
|
# Execute at startup
|
|
|
|
chpwd_show_todo
|