#! /bin/zsh # # also set the TODO_FILE env in ~/.zshenv # for Emacs, see: ~/.emacs.d/emacs-init/todo-did.el zudo-f () { local funs_str=$1 local -a funs funs=("${(@s/;/)funs_str}") for f in $funs; do eval "sudo $f" done } todo () { echo "This doesn't work ATM. Use \`todo' in Emacs." # echo "\n$@" >> $TODO_FILE } alias todo="noglob todo" accept-line () { local words words=( ${(z)BUFFER} ) case $words[1] in (todo) BUFFER="$words[1] ${(q-)words[2,-1]}" ;; (zudo) BUFFER="zudo-f ${(q-)words[2,-1]}" ;; esac zle .accept-line } zle -N accept-line