2 source ~/bin/.check-busybox
5 fpath=(~/.zsh ~/.zsh/functions/Prompts "${fpath[@]}")
8 setopt NO_BEEP NO_CLOBBER
10 setopt AUTO_CD CDABLE_VARS
14 setopt EXTENDED_GLOB GLOB_DOTS MARK_DIRS NOMATCH NUMERIC_GLOB_SORT
20 setopt NO_HIST_SAVE_BY_COPY HIST_IGNORE_DUPS SHARE_HISTORY
29 bindkey "^[[7~" beginning-of-line #Home
30 bindkey -a "^[[7~" beginning-of-line
31 bindkey "^[[8~" end-of-line #End
32 bindkey -a "^[[8~" end-of-line
33 bindkey "^[[3~" delete-char #Del
34 bindkey -a "^[[3~" delete-char
36 autoload -Uz up-line-or-beginning-search down-line-or-beginning-search && {
37 if [[ -n "$key[Up]" ]] {
38 zle -N up-line-or-beginning-search
39 bindkey -- "$key[Up]" up-line-or-beginning-search
41 if [[ -n "$key[Down]" ]] {
42 bindkey -- "$key[Down]" down-line-or-beginning-search
43 zle -N down-line-or-beginning-search
51 alias e="${EDITOR:-vi}" # TODO: make sure vi is there or use safe default
52 if [[ "$OSTYPE" =~ '^(free|net)bsd' ]] {
59 if which pstree >/dev/null 2>&1 && ! check-busybox pstree; then
60 # use pstree, but NOT busybox pstree because it kinda sucks
62 elif [[ "$OSTYPE" =~ '^freebsd' ]]; then
63 p="ps -aSdfxwwouser=USR -ogroup=GRP -opid,nice=NI \
64 -o%cpu,%mem,tty,stat,start=START -oetime,command"
65 elif check-busybox ps; then
67 p="ps -eouser='USR ' -ogroup='GRP ' \
68 -opid=' PID' -onice=' NI' -ovsz=' MEM' \
69 -otty,stat,etime,comm"
71 # XXX: untested, posix
72 # TODO: support gnu ps
73 p="ps -eouser=USR -ogroup=GRP -opid,nice=NI \
74 -opcpu=CPU -ovsz=MEM -otty,stat,etime,comm"
76 if [[ "$(basename "$PAGER")" = "less" ]] {
79 p="$p | \"${PAGER:-more}\""
85 alias va="source bin/activate"
90 if [[ "$OSTYPE" =~ '^freebsd' ]] {
91 # don't confirm if only a few files are deleted
94 # TODO: similar behavior for non-freebsd, or impliment in zsh
99 cd $(printf '../%.0s' {1..${1:-1}})
105 # change terminal title
106 # TODO: update and send BEL when job status changes
107 print -Pn "\e]2;%(1j,%j,)%#${SSH_CLIENT+$USER@$HOST:}%~\e\\"
108 # bell if exec takes 5s
109 if ((SECONDS - _exectime >= 5)) print "\a"
110 # we could update vcs_info here, but let prompt take care of it
111 # if it doesn't use vcs, it can be ignored safely
114 # change terminal title to show command
115 print -Pnf "\e]2;%s\e\\" "%#${SSH_CLIENT+$USER@$HOST:}$1"
116 # save last exec time for bell
117 # XXX: does not run for blank cmdline
121 # echo dir on cwd change
125 ### system-specific configs and aliases
129 bindkey "^[[H" beginning-of-line #Home
130 bindkey -a "^[[H" beginning-of-line
131 bindkey "^[[F" end-of-line #End
132 bindkey -a "^[[F" end-of-line
135 function s { sysctl hw.snd.default_unit${1:+\=$1} }
138 ## install port dependencies from pkg (like pkgsrc `bmake bin-install')
139 #XXX: should probably use package-depends where possible, breaks when
140 # port name is different to package name
141 # (eg. graphics/sdl20 == sdl2, devel/glib20 == glib2, etc)
145 sudo pkg install -AU $(make ${1}-depends-list |
146 sed 's_/usr/ports/_ _' | tr -d '\n')
148 *) echo "Usage: \`portpkg <build|run>' in a port directory"
156 ll /dev/mixer /dev/sound /dev/audio
159 for x in mixer sound audio; do
160 ln -sf /dev/$x"$1" /dev/$x
165 for x in $(mixerctl -a | grep 'outputs\.master'); do
170 mixerctl -w outputs.master"$2"="$1"
174 # TODO: test alsa/oss/sndio/portaudio/pulse in order of importance
181 autoload -Uz vcs_info
182 zstyle ':vcs_info:*' enable git
183 #zstyle ':vcs_info:git*' check-for-changes true #too slow
184 zstyle ':vcs_info:git*:dotfiles' check-for-changes true
185 zstyle ':vcs_info:git*' check-for-staged-changes true
188 # The following lines were added by compinstall
189 zstyle ':completion:*' auto-description '[arg] %d'
190 zstyle ':completion:*' expand suffix
191 zstyle ':completion:*' format '# %d'
192 zstyle ':completion:*' group-name ''
193 zstyle ':completion:*' ignore-parents parent
194 zstyle ':completion:*' insert-unambiguous false
195 zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
196 zstyle ':completion:*' list-prompt '%B%i%b'
197 zstyle ':completion:*' list-suffixes true
198 zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} r:|[._-]=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*'
199 zstyle ':completion:*' menu select=1
200 zstyle ':completion:*' original false
201 zstyle ':completion:*' select-prompt '%B%l%b'
202 zstyle ':completion:*' verbose true
203 zstyle :compinstall filename '/home/ds6/.zshrc'
205 autoload -Uz compinit
207 # End of lines added by compinstall
210 # do this last so prompt can potentially override
211 autoload -Uz promptinit && promptinit
216 unfunction check-busybox
218 # vim: set et sts=4 sw=4 ts=8 tw=79 :