Browse Source

Mark function asks for confirmation and uses basename of directory when no argument is given

Jeroen Janssens 11 years ago
parent
commit
255b0c4f5e
1 changed files with 9 additions and 1 deletions
  1. 9 1
      plugins/jump/jump.plugin.zsh

+ 9 - 1
plugins/jump/jump.plugin.zsh

@@ -13,7 +13,15 @@ jump() {
 }
 
 mark() {
-	mkdir -p "$MARKPATH"; ln -s "$(pwd)" $MARKPATH/$1
+	DIR="$(pwd)"
+	if (( $# == 0 )); then
+		MARK=$(basename $DIR)
+	else
+		MARK=$1
+	fi
+	if read -q \?"Mark ${DIR} as ${MARK}? (y/n) "; then
+		mkdir -p "$MARKPATH"; ln -s "${DIR}" "$MARKPATH/$MARK"
+	fi
 }
 
 unmark() {