added directory bookmarking

This commit is contained in:
Colin Henry 2021-09-08 11:47:33 -07:00
parent f01cf24c94
commit 7b08c09a22

View File

@ -0,0 +1,11 @@
# boosted from https://threkk.medium.com/how-to-use-bookmarks-in-bash-zsh-6b8074e40774 and adapted using mattn_jp's bash changes: https://twitter.com/mattn_jp/status/1434192554036137995?s=20
if [ -d "$HOME/.local/cdbookmarks" ]; then
export CDPATH=".:$HOME/.local/cdbookmarks:/"
alias goto="cd -P"
_goto()
{
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$(/bin/ls $HOME/.local/cdbookmarks)" -- ${COMP_WORDS[COMP_CWORD]}))
} && complete -F _goto goto
fi