Skip to content

Instantly share code, notes, and snippets.

@retrography
retrography / ndirs.sh
Last active June 11, 2017 22:52
Persistence layer for ZSH named directories. Introduces the following zsh functions: bm, rbm, lam, tbm
# Directory bookmark handler
touch ~/.ndirs
function rbm() { sed -i "/^$1\t/d" ~/.ndirs; export $1='' }
function tbm() { hash -d _="$(pwd)" }
function bm() { rbm $1; tbm $1; echo -e "$1\t$(pwd)" >> ~/.ndirs }
function lbm() { sort ~/.ndirs }
sed -e 's/^/hash -d /' -e 's/\t/="/' -e 's/$/"/' ~/.ndirs | while read line; do eval $line; done