Created
July 3, 2023 04:10
-
-
Save nathankellenicki/986b6e4988af56154fbfb348bac87f19 to your computer and use it in GitHub Desktop.
jumpmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export MARKPATH=$HOME/.marks | |
function jump { | |
cd -P $MARKPATH/$1 2>/dev/null || echo "No such mark: $1" | |
} | |
function mark { | |
mkdir -p $MARKPATH; ln -s "$(pwd)" $MARKPATH/$1 | |
} | |
function unmark { | |
rm -i $MARKPATH/$1 | |
} | |
function marks { | |
ls -l $MARKPATH | sed 's/ / /g' | cut -d' ' -f9- | sed 's/ -/\t-/g' && echo | |
} | |
_jump() { | |
local cur=${COMP_WORDS[COMP_CWORD]} | |
COMPREPLY=( $(compgen -W "$( ls $MARKPATH )" -- $cur) ) | |
} | |
complete -F _jump jump |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment