HISTFILE=~/.histfile HISTSIZE=1000 SAVEHIST=1000 #export PATH="$HOME/.local/bin:$PATH" #export LC_ALL="en_US.UTF-8" #export LANG="en_US.UTF-8" export PAGER="less" export EDITOR="nano" export LESS="-R -M --shift 5 -I" setopt appendhistory autocd extendedglob setopt hist_ignore_all_dups unsetopt beep notify bindkey -v autoload terminfo colors colors watch=all zstyle :compinstall filename "$HOME/.zshrc" autoload -Uz compinit compinit bindkey '[2~' overwrite-mode bindkey '[3~' delete-char bindkey '[7~' beginning-of-line bindkey '[8~' end-of-line bindkey '[5~' history-search-backward bindkey '[6~' history-search-forward # Per OS settings case `uname -s` in FreeBSD) export LSCOLORS="exgxfxcxcxdxdxhbadacec" alias ls="ls -G" ;; Linux) [ -f ~/.dir_colors ] && eval `dircolors -b ~/.dir_colors` alias ls="ls --color=auto" alias cal="cal -m" ;; esac # Per host settings case `hostname -s` in DeathStar) alias si="screen -DRAa -S irssi" alias sr="screen -DRAa -S rtorrent" alias sw="screen -DRAa -S web" [ $UID != 0 ] && umask 0027 ;; Dothan|Hoth) alias sr="screen -DRAa -S rails" alias sd="screen -DRAa -S dev" # alias snes9x="snes9x -stereo -r7 -y2" # alias osnes9x="osnes9x -stereo -r7 -y5" ;; esac # General settings #alias :q="exit" alias l="ls -AF" alias ll="ls -lh" alias la="ls -a" alias grep="grep --color=auto" alias sm="screen -DRAa -S main" alias sls="screen -list" # Right prompt with clock RPS1=" %{$fg[blue]%}%D{%d/%m/%y %H:%M:%S}%{$terminfo[sgr0]%}" PS2="%{$fg[cyan]%}%_>%{$terminfo[sgr0]%} " PS3="%{$fg[cyan]%}?#%{$terminfo[sgr0]%} " function title { case $TERM in screen) # Use these two for GNU Screen: print -nR $'\033k'$1$'\033'\\ print -nR $'\033]0;'$1$'\a' ;; xterm*|rxvt*|Eterm|eterm) # Use this one instead for XTerms: print -nR $'\033]0;'$1$'\a' ;; esac } function precmd { title "$(print -P "%n@%m:%y %~")" local nocolor="%{$terminfo[sgr0]%}" local bold="%{$nocolor$terminfo[bold]%}" local red="%{$nocolor$terminfo[bold]$fg[red]%}" local blue="%{$nocolor$fg[blue]%}" if [ $UID != 0 ]; then local deco="%{$nocolor$fg[cyan]%}" else local deco="%{$nocolor$fg[red]%}" fi if [ -O "$PWD" ]; then local path_color=$nocolor elif [ -w "$PWD" ]; then local path_color=$blue else local path_color=$red fi PS1="%(?..${deco}!${red}%?${deco}! )%(!.${red}.${bold})%n${deco}@${bold}%m${deco}:${bold}%y ${path_color}%~ ${deco}%#${nocolor} " } function preexec { emulate -L zsh local -a cmd; cmd=(${(z)1}) # Re-parse the command line # Construct a command that will output the desired job number. case $cmd[1] in fg) if (( $#cmd == 1 )); then # No arguments, must find the current job cmd=(builtin jobs -l %+) else # Replace the command name, ignore extra args. cmd=(builtin jobs -l ${(Q)cmd[2]}) fi;; %*) cmd=(builtin jobs -l ${(Q)cmd[1]});; # Same as "else" above exec) shift cmd;& # If the command is 'exec', drop that, because # we'd rather just see the command that is being # exec'd. Note the ;& to fall through. *) title "$(print -P "%n@%m:%y %~ \<${cmd//\%/\%\%}\>")" # Not resuming a job, return;; # so we're all done esac local -A jt; jt=(${(kv)jobtexts}) # Copy jobtexts for subshell # Run the command, read its output, and look up the jobtext. # Could parse $rest here, but $jobtexts (via $jt) is easier. $cmd >>(read num rest cmd=(${(z)${(e):-\$jt$num}}) title "$(print -P "%n@%m:%y %~ \<${cmd//\%/\%\%}\>")") 2>/dev/null }