Commit 55d4873f authored by Jeroen Janssens's avatar Jeroen Janssens
Browse files

Change marks function and remove 'function' keyword as suggested by pielgrzym...

Change marks function and remove 'function' keyword as suggested by pielgrzym in https://github.com/robbyrussell/oh-my-zsh/pull/2045#issuecomment-22820224
parent 4517db6a
...@@ -8,24 +8,30 @@ ...@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment