Change marks function and remove 'function' keyword as suggested by pielgrzym in https://github.com/robbyrussell/oh-my-zsh/pull/2045#issuecomment-22820224

This commit is contained in:
Jeroen Janssens 2013-09-06 09:40:44 -04:00
parent 4517db6acc
commit 55d4873f91

View File

@ -8,24 +8,30 @@
# #
export MARKPATH=$HOME/.marks export MARKPATH=$HOME/.marks
function jump { jump() {
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 { mark() {
mkdir -p "$MARKPATH"; ln -s "$(pwd)" $MARKPATH/$1 mkdir -p "$MARKPATH"; ln -s "$(pwd)" $MARKPATH/$1
} }
function unmark { unmark() {
rm -i "$MARKPATH/$1" rm -i "$MARKPATH/$1"
} }
function marks { autoload colors
ls -l "$MARKPATH" | sed 's/ / /g' | cut -d' ' -f9- | sed 's/ -/\t-/g' && echo marks() {
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
} }
function _completemarks { _completemarks() {
reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g')) 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