Skip to content

Commit 3d77cf0

Browse files
authored
Merge pull request #1 from spoike/patch-1
Use $EDITOR as editor for notes if it is set
2 parents 91627eb + 8d66590 commit 3d77cf0

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

_helpers/helpers.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,13 @@ function previewnotes {
8585

8686
}
8787

88-
88+
function opennote {
89+
if [ -z "$EDITOR" ]; then
90+
open $1
91+
else
92+
eval "$EDITOR $1"
93+
fi
94+
}
8995

9096
# help
9197
# --------------------------------------------------

bin/notes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ while getopts "$optstring" opt; do
125125
n)
126126
checkname "$OPTARG"
127127
mkdir -p $(dirname "$OPTARG${_ext}") && touch "$OPTARG${_ext}"
128-
open "$OPTARG${_ext}"
128+
opennote "$OPTARG${_ext}"
129129
exit 0
130130
;;
131131

@@ -215,7 +215,7 @@ if [ -z "$2" ]; then
215215
exit 0
216216
fi
217217

218-
open $1${_ext}
218+
opennote $1${_ext}
219219
exit 0
220220
fi
221221

0 commit comments

Comments
 (0)