From f26686a9fc93ddeaa43bd4c3016acab63447738c Mon Sep 17 00:00:00 2001 From: Charles Thorley Date: Thu, 12 Dec 2013 18:18:16 -0800 Subject: [PATCH] Bug fixes --- plugins/jump/mark.fish | 3 ++- plugins/jump/marks.fish | 31 ++++++++++++++++++------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/plugins/jump/mark.fish b/plugins/jump/mark.fish index d0546f4..5f23f41 100644 --- a/plugins/jump/mark.fish +++ b/plugins/jump/mark.fish @@ -3,9 +3,10 @@ function mark command ln -s (pwd) $MARKPATH/$argv[1] else if test (count $argv) -eq 2 if test -d $argv[2] + set -l current_dir (pwd) cd $argv[2] command ln -s (pwd) $MARKPATH/$argv[1] - cd - + cd $current_dir else echo "$argv[2] is not a valid directory." end diff --git a/plugins/jump/marks.fish b/plugins/jump/marks.fish index 07a3597..e658bbf 100644 --- a/plugins/jump/marks.fish +++ b/plugins/jump/marks.fish @@ -2,21 +2,26 @@ function marks if test (count $argv) -gt 0 echo "Usage: marks" else - set -l file_list (command ls $MARKPATH/) - set -l mark_list - for file in $file_list - if test -d $MARKPATH/$file -a -L $MARKPATH/$file - set mark_list $mark_list $file - end - end - if test (count $mark_list) -eq 0 + set -l file_list (command ls $MARKPATH) + if test (count $file_list) -eq 0 echo "No marks currently defined." else - for mark_name in $mark_list - cd $MARKPATH/$mark_name - set -l real_path (pwd) - cd - - echo "$mark_name -> $real_path" + set -l mark_list + for file in $file_list + if test -d $MARKPATH/$file -a -L $MARKPATH/$file + set mark_list $mark_list $file + end + end + if test (count $mark_list) -eq 0 + echo "No marks currently defined." + else + set -l current_dir (pwd) + for mark_name in $mark_list + cd $MARKPATH/$mark_name + set -l real_path (pwd) + echo "$mark_name -> $real_path" + end + cd $current_dir end end end