Related: links, .zshrc

function to quickly look at the documentation for a package, complete with tab completion

# Function Usage: doc packagename
#                 doc pac
doc()  { cd /usr/share/doc/$1 && ls }
_doc() { _files -W /usr/share/doc -/ }
compdef _doc doc

automatically update the xterm titlebar with the current directory name

case $TERM in
    xterm*)
        ## Run when the PWD is changed. Put the PWD in the title of the xterm.
        function precmd {
            [ -n "$NO_TITLE" ] && return
            print -Pn "\033]2; %n@%m - %~\007"
        }
        ;;
esac

if you're running a command that takes a few minutes on a remote machine and want to be notified when it's done in the xterm titlebar and with a beep

alias notify='NO_TITLE=1; echo -e '\a'; print -Pn "\033]2; DONE \007"'
alias notifyoff='unset NO_TITLE; print -Pn "\033]2;\007"'
  • to use: cp somehugefile /media; notify
  • to set the titlebar back to normal: notifyoff