浏览代码

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

Jeroen Janssens 11 年之前
父节点
当前提交
55d4873f91
共有 1 个文件被更改,包括 13 次插入7 次删除
  1. 13 7
      plugins/jump/jump.plugin.zsh

+ 13 - 7
plugins/jump/jump.plugin.zsh

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