From 255b0c4f5e16465ace326ddf1884ea2e7c1f3df1 Mon Sep 17 00:00:00 2001 From: Jeroen Janssens Date: Fri, 6 Sep 2013 09:55:43 -0400 Subject: [PATCH] Mark function asks for confirmation and uses basename of directory when no argument is given --- plugins/jump/jump.plugin.zsh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh index c6f266ae..e32a5a0b 100644 --- a/plugins/jump/jump.plugin.zsh +++ b/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() {