fi
}
-#f5# show labels and uuids of disk devices
-if is439 && [[ -d /dev/disk/by-id/ ]]; then
- lsdisk() {
- emulate -L zsh
- setopt extendedglob
- local -a -U disks
- local -A mountinfo
- disks=( /dev/disk/by-id/*(@:A) )
- [[ -r /proc/mounts ]] && for cline ( "${(f)$(</proc/mounts)[@]}" ) mountinfo["${cline[(w)1]:A}"]="${cline[(w)2,-1]}"
- for dev in "$disks[@]"; do
- print ${fg_bold[red]}${dev}${reset_color} /dev/disk/by-label/*(@e/'[[ ${REPLY:A} == $dev ]] && REPLY=${fg[blue]}LABEL=${REPLY:t}${reset_color}'/N) /dev/disk/by-uuid/*(@e/'[[ ${REPLY:A} == $dev ]] && REPLY=${fg[green]}UUID=${REPLY:t}${reset_color}'/N)
- [[ -n "${mountinfo["$dev"]}" ]] && print -f " Mount: %s -t %s -o %s\n" ${mountinfo["$dev"][(w)1]} ${mountinfo["$dev"][(w)2]} "${mountinfo["$dev"][(w)3,-5]}"
- for sysdevsize ( /sys/block/${dev:t}/size(N) /sys/block/${${dev:t}%%<->}/${dev:t}/size(N) ) \
- print -f " Size: %.3f GiB (%d Byte)\n" $(($(<$sysdevsize)/(2.0*1024.0*1024.0))) $(($(<$sysdevsize)*512))
-
- print -f " Id: %s\n" /dev/disk/by-id/*(@e/'[[ ${REPLY:A} == $dev ]]'/N:t)
- done
- }
-fi
-
-#f5# run command or function in a list of directories
-rundirs() {
- local d CMD STARTDIR=$PWD
- CMD=$1; shift
- ( for d ($@) {cd -q $d && { print cd $d; ${(z)CMD} ; cd -q $STARTDIR }} )
-}
-
# Translate DE<=>EN
# 'translate' looks up fot a word in a file with language-to-language
# translations (field separator should be " : "). A typical wordlist looks
esac
}
-#f5# List all occurrences of programm in current PATH
-plap() {
- emulate -L zsh
- if [[ $# = 0 ]] ; then
- echo "Usage: $0 program"
- echo "Example: $0 zsh"
- echo "Lists all occurrences of program in the current PATH."
- else
- ls -l ${^path}/*$1*(*N)
- fi
-}
-
-# Found in the mailinglistarchive from Zsh (IIRC ~1996)
-#f5# Select items for specific command(s) from history
-selhist() {
- emulate -L zsh
- local TAB=$'\t';
- (( $# < 1 )) && {
- echo "Usage: $0 command"
- return 1
- };
- cmd=(${(f)"$(grep -w $1 $HISTFILE | sort | uniq | pr -tn)"})
- print -l $cmd | less -F
- echo -n "enter number of desired command [1 - $(( ${#cmd[@]} - 1 ))]: "
- local answer
- read answer
- print -z "${cmd[$answer]#*$TAB}"
-}
-
-# Use vim to convert plaintext to HTML
-#f5# Transform files to html with highlighting
-2html() {
- emulate -L zsh
- vim -u NONE -n -c ':syntax on' -c ':so $VIMRUNTIME/syntax/2html.vim' -c ':wqa' $1 &>/dev/null
-}
-
# Usage: simple-extract <file>
# Using option -d deletes the original archive file.
#f5# Smart archive extractor
fi
}
-# It's shameless stolen from <http://www.vim.org/tips/tip.php?tip_id=167>
-#f5# Use \kbd{vim} as your manpage reader
-vman() {
- emulate -L zsh
- if (( ${#argv} == 0 )); then
- printf 'usage: vman <topic>\n'
- return 1
- fi
- man "$@" | col -b | view -c 'set ft=man nomod nolist' -
-}
-
-# function readme() { $PAGER -- (#ia3)readme* }
-#f5# View all README-like files in current directory in pager
-readme() {
- emulate -L zsh
- setopt extendedglob
- local files
- files=(./(#i)*(read*me|lue*m(in|)ut|lies*mich)*(NDr^/=p%))
- if (($#files)) ; then
- $PAGER $files
- else
- print 'No README files.'
- fi
-}
-
# TODO: So, this is the third incarnation of this function!?
#f5# Reload given functions
refunc() {