From d0384efad46b417b3aa21b40b0d7b106ffbf6f28 Mon Sep 17 00:00:00 2001 From: Bodaniel Jeanes Date: Mon, 22 Nov 2010 21:31:42 +1000 Subject: [PATCH] Improve the 'm' function so that it sets the current working directly correctly (e.g. when using mvim) and uses the current $VISUAL editor. --- shell/functions.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/shell/functions.sh b/shell/functions.sh index f15dccd..7482ae0 100644 --- a/shell/functions.sh +++ b/shell/functions.sh @@ -20,12 +20,19 @@ function p() { cd $* && m } function m() { + file=. + cd_to=. + if [ -n "$*" ]; then - files=$* - else - files=. + if [ -d "$1" ]; then + cd_to=$1 + file=. + else + file=$* + fi fi - mate -l1 $files 2>/dev/null + + bash -l -c "cd $cd_to && $VISUAL $file" } function extract() {