Skip to content

Instantly share code, notes, and snippets.

@retrography
Last active June 11, 2017 22:52
Show Gist options
  • Save retrography/9d6e4dde54e451885f40 to your computer and use it in GitHub Desktop.
Save retrography/9d6e4dde54e451885f40 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment