From 40261817ed3121794e9e1dfbf180c0d9a47af039 Mon Sep 17 00:00:00 2001 From: Jack Jackson Date: Sun, 10 Jul 2022 00:30:02 -0700 Subject: [PATCH] Expand EDITOR options in np.sh --- np.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/np.sh b/np.sh index cf0e0c0..df68d73 100755 --- a/np.sh +++ b/np.sh @@ -15,7 +15,16 @@ pushd blog > /dev/null hugo new "posts/$postName.md" outputLocation="content/posts/$postName.md" -if [ -n "$EDITOR" ]; then +# Use our own env variable to encode which editor +# should be used to edit blogposts. Setting $VISUAL +# to `subl` leads to it also being used by (among +# others) zsh's `edit-command-line`, which is +# undesired +if [ -n "$BLOG_EDITOR" ]; then + $BLOG_EDITOR $outputLocation +elif [ -n "$VISUAL" ]; then + $VISUAL $outputLocation +elif [ -n "$EDITOR" ]; then $EDITOR $outputLocation else echo "No default editor set - falling back to Sublime"