mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-22 13:50:09 +00:00
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:
parent
4517db6acc
commit
55d4873f91
1 changed files with 13 additions and 7 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue