Jump Terminal Command


mkdir ~/.marks

Then add this to your ~/.zshrc or ~/.bashrc:

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 -if "$MARKPATH/$1"

function marks {
    ls -l $MARKPATH | sed 's/  / /g' | cut -d' ' -f9- | sed 's/ -/ -/g' && echo

function _marks {
    reply=($(ls $MARKPATH))

compctl -K _marks jump
compctl -K _marks unmark

To use:

Now to remember a directory you type

mark <any_string>

and to jump to that directory you type

jump <any_string>

To list all your shortcuts


Leave a Reply