guest@dotshare [~/groups/shells/zsh] $ ls ZSH-for-seperatists/ | cat

ZSH (for seperatists)

milomouse Jun 24, 2011 (shells/zsh)

.zshrc(raw, dl)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
# source external configuration files:
ZDOTDIR="${HOME}/zsh"
for i in ${ZDOTDIR}/{options,exports,aliases,functions}; do
  . $i || { print "$i: cannnot source file" && setopt warncreateglobal }
done

# prompt line:
[[ ${TERM} =~ screen ]] && precmd() { print -Pn "\e]2;%2d\a" } || RPROMPT='%F{white}%~%f'
PS1='%B%F{cyan}%#%f%b '
PS2='  '
PS3='%B%F{white}?# %b%f%F{red}%# %f'
PS4='%B%F{white}%_ %b%f%F{magenta}%# %f%B%F{white}+%N:%i %b%f%F{magenta}%# %f'

# auto-completion:
autoload -U compinit
compinit
_force_rehash() { (( CURRENT == 1 )) && rehash ; return 1 }
zstyle ':completion:::::' completer _force_rehash _expand _complete _approximate 
zstyle ':completion:*:descriptions' format "- %d -"
zstyle ':completion:*:default' list-prompt '%S%M matches%s'
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*:manuals.(^1*)' insert-sections true
zstyle ':completion:*' verbose true
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ${XDG_CACHE_HOME:-${HOME}/cache}
zstyle ':completion:*' squeeze-slashes true
zstyle ':completion:*:functions' ignored-patterns '_*'
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:*:kill:*:processes' command 'ps haxopid:5,user:4,%cpu:4,ni:2,stat:3,etime:8,args'
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' force-list always
[[ -a $(whence -p pacman-color) ]] && compdef _pacman pacman-color=pacman

# framebuffer colors:
if [[ ${TERM} == linux ]] || [[ ${TERM} =~ screen && ${+DISPLAY} == 0 ]]; then
    echo -en "\e]P0000000" ; echo -en "\e]P83d3a3a"
    echo -en "\e]P1d74b73" ; echo -en "\e]P9e07895"
    echo -en "\e]P2799c99" ; echo -en "\e]PA85afa9"
    echo -en "\e]P3c8bc45" ; echo -en "\e]PBbaa02c"
    echo -en "\e]P476ace2" ; echo -en "\e]PC98a7b6"
    echo -en "\e]P5a488d9" ; echo -en "\e]PD9f8bab"
    echo -en "\e]P6508686" ; echo -en "\e]PE569e9a"
    echo -en "\e]P78d8d8d" ; echo -en "\e]PFdad3d3"
fi

# Fish-like syntax highlighting for ZSH (by nicoulaj@github):
if [[ -f ${ZDOTDIR}/scripts/zsh-syntax-highlighting.zsh ]]; then
  . ${ZDOTDIR}/scripts/zsh-syntax-highlighting.zsh || print 'could not source SYNTAX'

  # override some colors:
  ZSH_HIGHLIGHT_STYLES[default]='none'
  ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red,bold,underline'
  ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=green'
  ZSH_HIGHLIGHT_STYLES[alias]='fg=magenta'
  ZSH_HIGHLIGHT_STYLES[builtin]='fg=magenta,bold'
  ZSH_HIGHLIGHT_STYLES[function]='fg=magenta'
  ZSH_HIGHLIGHT_STYLES[command]='fg=magenta,bold'
  ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=red,bold,standout'
  ZSH_HIGHLIGHT_STYLES[path]='fg=white,underline'
  ZSH_HIGHLIGHT_STYLES[globbing]='fg=white,bold'
  ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=green'
  ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=blue'
  ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=blue'
  ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=red,bold'
  ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=red'
  ZSH_HIGHLIGHT_STYLES[assign]='fg=green,bold'
  ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=cyan,bold'
  ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=cyan'

  # override colors for matching brackets:
  ZSH_HIGHLIGHT_MATCHING_BRACKETS_STYLES=(
    'fg=blue,bold'    # Style for first level of imbrication
    'fg=green,bold'   # Style for second level of imbrication
    'fg=magenta,bold' # etc... Put as many styles as you wish, or leave
    'fg=cyan,bold'    # empty to disable brackets matching.
    'fg=white,bold'
    'fg=blue'
    'fg=green'
    'fg=magenta'
    'fg=cyan'
    'fg=white'
  )
fi

# Fish-like history sub-string search:
if [[ -f ${ZDOTDIR}/scripts/history-substring-search.zsh ]]; then
  . ${ZDOTDIR}/scripts/history-substring-search.zsh || print 'could not source HISTORY'
fi

# keybindings (defined AFTER scripts):
bindkey "^[[2~" overwrite-mode
bindkey "^[[3~" delete-char
bindkey "^[[5~" up-line-or-search 
bindkey "^[[6~" down-line-or-search 
bindkey "^[[1~" beginning-of-line
bindkey "^[[7~" beginning-of-line
bindkey "^[[4~" end-of-line
bindkey "^[[8~" end-of-line
bindkey "^?" backward-delete-char
bindkey '^R' history-incremental-search-backward

CLICK TO VIEW

x

options(raw, dl)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# 01 -> changing directories:
  setopt autocd
  setopt autopushd
unsetopt cdablevars
unsetopt chasedots
  setopt chaselinks
  setopt pushdignoredups
unsetopt pushdminus
unsetopt pushdsilent
unsetopt pushdtohome
# 02 -> completion:
  setopt alwayslastprompt
  setopt alwaystoend
  setopt autolist
  setopt automenu
  setopt autonamedirs
  setopt autoparamkeys
  setopt autoparamslash
  setopt autoremoveslash
unsetopt bashautolist
  setopt completealiases
  setopt completeinword
unsetopt globcomplete
  setopt hashlistall
  setopt listambiguous
unsetopt listbeep
  setopt listpacked
unsetopt listrowsfirst
  setopt listtypes
unsetopt menucomplete
unsetopt recexact
# 03 -> expansion and globbing:
  setopt badpattern
  setopt bareglobqual
unsetopt braceccl
  setopt caseglob
  setopt casematch
unsetopt cshnullglob
  setopt equals
  setopt extendedglob
  setopt glob
unsetopt globassign
  setopt globdots
unsetopt globsubst
unsetopt histsubstpattern
unsetopt ignorebraces
unsetopt kshglob
unsetopt magicequalsubst
  setopt markdirs
  setopt multibyte
  setopt nomatch
unsetopt nullglob
  setopt numericglobsort
unsetopt rcexpandparam
unsetopt rematchpcre
unsetopt shglob
  setopt warncreateglobal
# 04 -> history:
  setopt appendhistory
  setopt banghist
unsetopt extendedhistory
unsetopt histallowclobber
unsetopt histbeep
  setopt histexpiredupsfirst
unsetopt histfcntllock
  setopt histfindnodups
unsetopt histignorealldups
  setopt histignoredups
  setopt histignorespace
  setopt histnofunctions
  setopt histnostore
  setopt histreduceblanks
unsetopt histsavebycopy
unsetopt histsavenodups
  setopt histverify
  setopt incappendhistory
unsetopt sharehistory
# 05 -> initilisation:
unsetopt allexport
unsetopt globalexport
unsetopt globalrcs
  setopt rcs
# 06 -> input/output:
  setopt aliases
unsetopt clobber
  setopt correct
unsetopt correctall
  setopt dvorak
  setopt flowcontrol
unsetopt ignoreeof
unsetopt interactivecomments
  setopt hashcmds
  setopt hashdirs
unsetopt mailwarning
unsetopt pathdirs
unsetopt printeightbit
unsetopt printexitvalue
unsetopt rcquotes
unsetopt rmstarsilent
unsetopt rmstarwait
  setopt shortloops
unsetopt sunkeyboardhack
# 07 -> job control:
  setopt autocontinue
unsetopt autoresume
  setopt bgnice
  setopt checkjobs
  setopt hup
  setopt longlistjobs
  setopt monitor
  setopt notify
# 08 -> prompting:
  setopt promptbang
  setopt promptcr
  setopt promptsp
  setopt promptpercent
  setopt promptsubst
unsetopt transientrprompt
# 09 -> scripts and functions:
unsetopt cbases
unsetopt cprecedences
  setopt debugbeforecmd
unsetopt errexit
unsetopt errreturn
  setopt evallineno
  setopt exec
  setopt functionargzero
unsetopt localoptions
unsetopt localtraps
  setopt multifuncdef
  setopt multios
unsetopt octalzeroes
unsetopt typesetsilent
unsetopt verbose
unsetopt xtrace
# 10 -> shell emulation:
unsetopt bashrematch
  setopt bsdecho
unsetopt cshjunkiehistory
  setopt cshjunkieloops
unsetopt cshjunkiequotes
unsetopt cshnullcmd
unsetopt ksharrays
unsetopt kshautoload
  setopt kshoptionprint
unsetopt kshtypeset
unsetopt kshzerosubscript
unsetopt posixaliases
unsetopt posixbuiltins
unsetopt posixidentifiers
unsetopt shfileexpansion
unsetopt shnullcmd
unsetopt shoptionletters
unsetopt shwordsplit
unsetopt trapsasync
# 11 -> shell state:
#  setopt interactive # do not set!
#  setopt login       # do not set!
#unsetopt privileged  # do not set!
#unsetopt restricted  # do not set!
#  setopt shinstdin   # do not set!
unsetopt singlecommand
# 12 -> zle:
unsetopt beep
unsetopt combiningchars
unsetopt emacs
unsetopt overstrike
unsetopt singlelinezle
  setopt vi
  setopt zle
 

x

exports(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# global environment exports:
export HTTP_PROXY=http://127.0.0.1:8118
export H="/howl"
export XDG_CACHE_HOME="${HOME:-/howl/conf}/cache"
export XDG_CONFIG_HOME="${HOME:-/howl/conf}"
export XDG_CONFIG_DIR="${XDG_CONFIG_HOME}"
export XDG_CONFIG_DIRS="/etc/xdg:${XDG_CONFIG_HOME}"
export XDG_DATA_HOME="${XDG_CONFIG_HOME}/share"
export XDG_DESKTOP_DIR="/tmp/.${UID}"
export XDG_DOCUMENTS_DIR="${H}/rite"
export XDG_DOWNLOAD_DIR="${H}/down"
export XDG_MUSIC_DIR="${H}/muzk"
export XDG_PICTURES_DIR="${H}/foto"
export XDG_PUBLICSHARE_DIR="/tmp/.${UID}"
export XDG_TEMPLATES_DIR="/tmp/.${UID}"
export XDG_VIDEOS_DIR="${H}/vide"
export XAUTHORITY="${XDG_CONFIG_HOME}/xorg/.Xauthority"
export HISTFILE="${ZDOTDIR:-${XDG_CONFIG_HOME}/zsh}/.history"
export HISTSIZE=1400
export SAVEHIST=1000
export DIRSTACKSIZE=20
export PAGER="/usr/bin/most"
export SDCV_PAGER="/bin/more"
export SDCV_HISTSIZE=0
export EDITOR="/usr/bin/vim"
#export MOST_SWITCHES="-c"
export MOST_EDITOR="${EDITOR}"
export FCEDIT="${EDITOR}"
export BZR_EDITOR="${EDITOR}"
export BZR_HOME="${XDG_CONFIG_HOME}/bazaar"
export BROWSER="/usr/bin/w3m"
export HOMEPAGE="https://bbs.archlinux.org/search.php?action=show_new"
export SHELL="/bin/zsh"
export GPG_TTY="$(tty)"
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
export LC="en_US.UTF-8"
export LESSCHARSET="UTF-8"
export LESSHISTFILE="${XDG_PUBLICSHARE_DIR}/.${UID}/less_history"
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[00;35m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[00;47;30m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[00;34m'
 

x

aliases(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# file management:
alias ls="/bin/ls -h --file-type --time-style='+%y-%m-%d %H%M%S' --color=auto --group-directories-first"
alias la="ls -A"
alias lb="ls -Ssr"
alias lt="ls -tr"
alias lm="lt -c"
alias lx="ls -X"
alias lls="ls -l"
alias lla="lls -A"
alias llb="lls -Ssr"
alias llt="lls -tr"
alias llm="llt -c"
alias llx="lx -l"
alias rd="/bin/rm -r"

# useless quick views/edits:
alias wika="${BROWSER:-/usr/bin/w3m} /usr/share/doc/arch-wiki/html/index.html"
alias sedit="${EDITOR:-/usr/bin/vim} -p ${HOME}/.stumpwmrc ${XDG_CONFIG_DIR:-${HOME}}/stumpwm/{functions,macros,commands,hooks,key-maps}.lisp"
alias zedit="${EDITOR:-/usr/bin/vim} -p ${HOME}/{.zshrc,zsh/{functions,aliases,exports,options,.zlogin}}"
alias xedit="${EDITOR:-/usr/bin/vim} -p ${XDG_CONFIG_DIR:-${HOME}}/xorg/{xinitrc,Xdefaults}"
alias zload=". ${HOME}/.zshrc"
alias xload="xrdb -load ${XDG_CONFIG_DIR:-${HOME}}/xorg/Xdefaults &>/dev/null"
alias gh="cd ${H:-/howl}"

# program masquing:
alias sudo='/usr/bin/sudo '
alias svim="sudo ${EDITOR:-/usr/bin/vim}"
alias info="/usr/bin/info --vi-keys"
alias diff="/usr/bin/colordiff"
alias grep="/bin/grep --color=auto"
alias mutt="/usr/bin/mutt -F ${XDG_CONFIG_DIR:-${HOME}}/mutt/muttrc"
alias xskat="/usr/bin/xskat -opt ${XDG_CONFIG_DIR:-${HOME}}/xorg/xskat.opt -list ${XDG_CONFIG_DIR:-${HOME}}/xorg/xskat.lst"
alias offlineimap="/usr/bin/offlineimap -c ${XDG_CONFIG_DIR:-${HOME}}/.offlineimap/offlineimaprc"
alias rtorrent="/usr/bin/rtorrent -o http_capath=/etc/ssl/certs"
alias startx="cd ~/ && /usr/bin/startx ${XDG_CONFIG_DIR:-${HOME}}/xorg/xinitrc -- -nolisten tcp -once -retro ; pushd -q +1"

# system/media shortcuts:
alias psu="print 'ELAPSETIME  %CPU NI +?   LWPID # COMMAND';/bin/ps -U root,privoxy,15,http,daemon,nobody,unbound --deselect -C tmux,urxvt -H hoetime:10,%cpu:5,ni:2,stat:4,pid:5,rtprio:1,args"
alias psr="print 'ELAPSETIME  %CPU NI +?   LWPID # COMMAND';/bin/ps -u root -U root -H hoetime:10,%cpu:5,ni:2,stat:4,pid:5,rtprio:1,args"
alias psa="print 'ELAPSETIME USER  %CPU NI +?   LWPID # COMMAND';/bin/ps -H haxoetime:10,user:4,%cpu:5,ni:2,stat:4,pid:5,rtprio:1,args"
alias pso="print 'ELAPSETIME USER  %CPU NI +?   LWPID # COMMAND';/bin/ps -U root,h --deselect -u root,h -H hoetime:10,user:4,%cpu:5,ni:2,stat:4,pid:5,rtprio:1,args"
alias dfu="/bin/df -hTP -x debugfs"
alias dii="/usr/bin/di -x debugfs -d h -Af sMTbuf"
alias mii="/usr/bin/mi -x debugfs"
alias loadavg='print ${$(</proc/loadavg)[1,3]}'
alias daemons='lt /run/daemons'
alias reboot='/bin/sync && sudo /sbin/reboot'
alias {poweroff,pow}='/bin/sync && sudo /sbin/poweroff'
alias mix2="/usr/local/bin/ossvol --speakers --quiet && /usr/local/bin/ossvol -a"
alias mix3="/usr/local/bin/ossvol --headphones --quiet && /usr/local/bin/ossvol -a"
alias siteget="/usr/bin/wget --recursive --page-requisites --convert-links --html-extension --no-parent --random-wait --limit-rate=20K -U Mozilla -l" #depth, then url

# database/package management:
alias upf="sudo /usr/bin/fc-cache -vr"
alias upd="sudo /etc/cron.daily/updatedb"
alias upm="sudo /usr/bin/mandb --quiet"
alias pacman="sudo /usr/bin/pacman-color"
 

x

functions(raw, dl)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# use history, but skip certain cmds/args from being written:
function zshaddhistory {
  local line cmd
  line=${1%%$'\n'} ; cmd=${line%% *}
  [[ ${#line} -ge 5
      && ${cmd} != (history|fc|mpq|srm|rms|rds)
      && ${cmd} != ([szx]edit|[zx]load|zhist|wika)
  ]] && (( ! $argv[(I)*unrl*|*spar*|*losetup*|*aespipe*|*litika*|sudo rm*] ))
}

## test arguments and [if valid] prepend file:// to local requests:
#function {jumanji,vimprobable} {
#  setopt no_warncreateglobal
#  for i in {1..999}; do # this will break when arguments run out
#    if [[ ${+i} == 1 && ${(P)i} != ${(P)$(($i - 1))} ]]; then
#      if [[ -f $PWD/${(P)i} ]]; then __urls=(${__urls} file://$PWD/${(P)i})
#      elif [[ -f ${(P)i} ]]; then __urls=(${__urls} file://${(P)i})
#      else __urls=(${__urls} ${(P)i}) ; fi
#    else if [[ ${+__urls} == 1 ]]; then
#        command $0 ${__urls} 2>/dev/null ; unset __urls ; break ; fi ; fi
#  done
#}

# attach rtorrent from daemon mode to view/edit torrents:
function rot {
  if [[ ${TERM} =~ screen ]]; then
    print "Aborting, please avoid nesting sessions.."
  else
    /usr/bin/tmux -S /tmp/.${UID}/tmux/rtorrent attach-session
  fi
}

# check ownership of given argument, as determined by pacman:
function owns {
  if [[ -n $(for each in ${PATH//:\\\n}; do
             find ${each}/$1 2>/dev/null ; done) ]]
  then pacman -Qo $(which -p $1)
  else pacman -Qo $1 ; fi
}

# jump to previous directory by integer or reg-exp, also list dirs,
# else jump to last visited directory if no argument supplied:
function back {
  if [[ $# == 1 ]]; then
    case $1 {
      <->)  pushd -q +$1 2>/dev/null ;;
      --)   dirs -lpv|sed '2s|$| \[last\]|' ;;
      *)    [[ -n $(dirs -lpv|grep -i $1|grep -v ${PWD}) ]] && \
              pushd -q +${$(dirs -lpv|grep -i $1|grep -v ${PWD})[1]}
    }
  else pushd -q - 2>/dev/null ; fi
}

# go up Nth amount of directories:
function up {
  local arg=${1:-1};
  while [ ${arg} -gt 0 ]; do
    cd .. >&/dev/null;
    arg=$((${arg} - 1));
  done
}

# copy and follow file to new dir:
function cpf {
  if [[ -d $*[-1] ]]; then
    cp $* && cd $*[-1]
  elif [[ -d ${*[-1]%/*} ]]; then
    cp $* && cd ${*[-1]%/*}
  fi
}

# move and follow file to new dir:
function mvf {
  if [[ -d $*[-1] ]]; then
    mv $* && cd $*[-1]
  elif [[ -d ${*[-1]%/*} ]]; then
    mv $* && cd ${*[-1]%/*}
  fi
}

# show ps information with simple output for scripts, quick views, etc:
function psi {
  if [[ ${#${@:/$0}} -ge 2 ]]; then
    case $1 {
      '-C'|'-c')  ps -C $2 hopid,args ;; # by- command name
      '-G'|'-g')  ps -G $2 hopid,args ;; # by- real group id (RGID)/name
      '-U'|'-u')  ps -U $2 hopid,args ;; # by- effective user ID (EUID)/name
      '-P'|'-p')  ps -p $2 hoargs ;;     # by- pid
      '-S'|'-s')  ps -s $2 hopid,args ;; # by- session id
      '-T'|'-t')  ps -t $2 hopid,args ;; # by- tty
      *) print "invalid selection. read: man ps (section: process selection by list)"
    }
  else
        << EOP
(show process information by .. )
psi -c ARG  | command name
psi -g ARG  | group id
psi -u ARG  | user id
psi -p ARG  | pid
psi -s ARG  | session id
psi -t ARG  | tty
EOP
  fi
}

# native function for showing 256 colors, properly formatted:
function 256co {
  for line in {0..15}; do for col in {0..15}; do
      local code=$(( $col * 16 + ${line} ))
      printf $'\e[38;05;%dm %03d' ${code} ${code}
    done
  print ; done
}

# function to quickly play video files:
function mpq {
  setopt no_warncreateglobal
  [[ -z ${DISPLAY} && $(tty) = /dev/tty[1-3] ]] && _mopt=(-vo fbdev)
  case $1 {
    'm') local _vol=${$(command ossmix|grep outvol)[-2]}
         command ossmix vmix0-outvol 25 &>/dev/null
         command mplayer ${_mopt} -volume 100 -fs -really-quiet -msglevel all=0 ${@:/$1} &>/dev/null
         command ossmix vmix0-outvol ${_vol} &>/dev/null ;;
    *)   command mplayer ${_mopt} -volume 100 -really-quiet -msglevel all=0 ${@} &>/dev/null
  }
  setopt warncreateglobal
}

# function to quickly view word definitions:
function sd {
  case $1 in
    '-r'|'-ru') sdcv -u "en-ru-bars" ${@:/$1} 2>/dev/null ;;
    '-w'|'-wordnet') sdcv -u "WordNet" ${@:/$1} 2>/dev/null ;;
    '-t'|'-thesaurus') sdcv -u "English Thesaurus" ${@:/$1} 2>/dev/null ;;
    '-a'|'-all') sdcv ${@:/$1} 2>/dev/null ;;
    *) sdcv $@ 2>/dev/null
  esac
}

# un-smart function for my todo lists:
function todo {
  case $# {
    0) command ls -1 ${H:-/howl}/othe/.TODO_* ;;
    1) command vim ${H:-/howl}/othe/.TODO_$1 ;;
    *) command vim ${H:-/howl}/othe/.TODO_${@// /_}
  }
}

# un-smart function for viewing/editing history file (still use 'fc/history'):
function zhist {
  if [[ $# == 1 ]]; then
    case $1 {
      e)  ${EDITOR:-/usr/bin/vim} ${ZDOTDIR:-${HOME}/zsh}/.history ;;
      a)  <${ZDOTDIR:-${HOME}/zsh}/.history | less ;;
      *)  <${ZDOTDIR:-${HOME}/zsh}/.history|grep -i $1
    }
  fi
}

# quirky tmux function:
function tmux {
  if [[ ${@[-2]} == '--' ]]; then
    command tmux ${@%--}
  else
    case ${+DISPLAY} in
      0)  command tmux -S /tmp/.${UID}/tmux/default $@ ;;
      1)  command tmux -S /tmp/.${UID}/tmux/xorg $@ ;;
    esac
  fi
}

# one-liners/micro functions:
function flashproc { for f (${$(file /proc/$(pidof luakit)/fd/*|gawk '/\/tmp\/Flash/ {print $1}')//:}){print - "$f"} }
function lss { ls -- ${1:-.}/*(D.om) }
function rc { [[ -n $1 ]] && sudo /etc/rc.d/$1 ${@:/$1} }
function alv { <${${$(command find ${H:-/howl}/othe/archive/installed_*)}[${1:--1}]}|w3m -o pagerline=1000 -o confirm_qq=0 }
function mkcd { command mkdir -p "$@" && cd "$@" }
function pubip { curl -m 30 http://automation.whatismyip.com/n09230945.asp }
function newmail { print - ${(Fw)#$(find /howl/mail/*/*/new -type f)} }
function qdep { pacman-color -Q $@ $(pacman-color -Qi $@|grep Depends|cut -d: -f2-|sed -E 's|>\S+\>||g') }
function timec { print "$(date +'%T %Y-%m-%d')" ; while sleep 1 ; do printf '\r%s ' "$(date +'%T %Y-%m-%d')" ; done }
function dropcache { sync && command su -s /bin/zsh -c 'echo 1 > /proc/sys/vm/drop_caches && echo 2 > /proc/sys/vm/drop_caches' root }
 

x

Notes

UPDATED (updated due to dotshare.it multi-file update)

Nothing too fantastic; ZSH setup I’ve been using for a while, along with nicoulaj’s zsh-syntax-highlighting I posted in other screenshots ( https://github.com/nicoulaj/zsh-syntax-highlighting ) and sunaku’s zsh-history-substring-search ( https://github.com/sunaku/zsh-history-substring-search ) [which i slightly modifed on my side].