Skip to content

Instantly share code, notes, and snippets.

@vmeyet
Created October 15, 2014 09:08
Show Gist options
  • Save vmeyet/412141a73ec4398359b1 to your computer and use it in GitHub Desktop.
Save vmeyet/412141a73ec4398359b1 to your computer and use it in GitHub Desktop.
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" | tail -n +2 | sed 's/ / /g' | cut -d' ' -f9- | awk -F ' -> ' '{printf "%-10s -> %s\n", $1, $2}'
}
function _completemarks {
reply=($(ls $MARKPATH))
}
compctl -K _completemarks jump
compctl -K _completemarks unmark
alias j=jump
alias m=mark
alias um=unmark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment