dotfiles/zsh/plugins/jump.plugin.zsh

24 lines
483 B
Bash

# Jump through folders.
if [[ -d "$HOME/.bookmarks" ]]; then
export CDPATH=".:$HOME/.bookmarks:/"
# Functions
function jump_add_bookmark() {
ln -sf $(pwd) $HOME/.bookmarks/$1
}
function jump_del_bookmark() {
rm $HOME/.bookmarks/$1
}
function jump_list() {
ls -l $HOME/.bookmarks | sed -ne '/^l/p' | sed -e 's/[^@]*//'
}
alias jump="cd -P"
alias j="cd -P"
alias jl="jump_list"
alias ja="jump_add_bookmark"
alias jd="jump_del_bookmark"
fi