Skip to content

Instantly share code, notes, and snippets.

@xeb
Last active December 21, 2015 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xeb/6257472 to your computer and use it in GitHub Desktop.
Save xeb/6257472 to your computer and use it in GitHub Desktop.
Marks system navigation
export MARKPATH=$HOME/.marks
function jump {
cd $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- && echo
}
function _jump {
local cur=${COMP_WORDS[COMP_CWORD]}
local marks=$(find $MARKPATH -type l -printf "%f\n")
COMPREPLY=($(compgen -W '${marks[@]}' -- "$cur"))
return 0
}
complete -o default -o nospace -F _jump jump
@xeb
Copy link
Author

xeb commented Aug 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment