Merge remote-tracking branch 'bors-ltd/master'

Conflicts:
	README.textile
	plugins/git/git.plugin.zsh
	plugins/jump/jump.plugin.zsh
This commit is contained in:
Gaetan Semet 2013-09-10 11:00:09 +02:00
commit 28c3ca4ead

View file

@ -6,10 +6,15 @@
# unmark FOO: delete a mark # unmark FOO: delete a mark
# marks: lists all marks # marks: lists all marks
# #
export MARKPATH=$HOME/.marks export MARKPATH=$HOME/.marks
function jump {
function jump()
{
if [[ -z $1 ]]; then if [[ -z $1 ]]; then
echo "Error: no mark required" echo "Error: no mark name given"
echo "available marks:"
marks
return return
fi fi
if [[ $1 == "--help" ]]; then if [[ $1 == "--help" ]]; then
@ -20,29 +25,59 @@ function jump {
echo " 'marks': lists all marks" echo " 'marks': lists all marks"
return return
fi fi
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
} }
function mark {
mkdir -p "$MARKPATH"; ln -s "$(pwd)" $MARKPATH/$1 function mark()
} {
function unmark { if (( $# == 0 )); then
rm -i "$MARKPATH/$1" MARK=$(basename "$(pwd)")
}
function marks {
if [[ -d $MARKPATH ]]; then
ls -l "$MARKPATH" | sed 's/ / /g' | cut -d' ' -f9- | sed 's/ -/\t-/g' && echo
else else
echo "No mark directory" MARK="$1"
fi
if read -q \?"Mark $(pwd) as ${MARK}? (y/n) "; then
mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$MARK"
fi fi
} }
function _completemarks { function unmark()
reply=($(ls $MARKPATH)) {
rm -i "$MARKPATH/$1"
}
autoload colors
function marks()
{
if [[ -d $MARKPATH ]]; then
for link in $MARKPATH/*(@); do
local markname="$fg[cyan]${link:t}$reset_color"
local markpath="$fg[blue]$(readlink $link)$reset_color"
printf "%s\t" $markname
printf "-> %s \t\n" $markpath
done
else
echo "No mark found."
fi
}
function _completemarks()
{
reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g'))
} }
compctl -K _completemarks jump compctl -K _completemarks jump
compctl -K _completemarks unmark compctl -K _completemarks unmark
function _mark_expansion()
{
setopt extendedglob
autoload -U modify-current-argument
modify-current-argument '$(readlink "$MARKPATH/$ARG")'
}
zle -N _mark_expansion
bindkey "^g" _mark_expansion
alias j='jump' alias j='jump'
compdef _jump j=jump compdef _jump j=jump