From f3695b95fc95fa53dee2a7ce41a171215ea75d5b Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 2 Sep 2015 13:55:59 +0200 Subject: [PATCH] Use $VISUAL before $EDITOR in funced Closes #2268 --- doc_src/funced.txt | 2 +- share/functions/funced.fish | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc_src/funced.txt b/doc_src/funced.txt index 143efba43..d1cf45a77 100644 --- a/doc_src/funced.txt +++ b/doc_src/funced.txt @@ -9,7 +9,7 @@ funced [OPTIONS] NAME `funced` provides an interface to edit the definition of the function `NAME`. -If the `$EDITOR` environment variable is set, it will be used as the program to edit the function. Otherwise, a built-in editor will be used. +If the `$VISUAL` environment variable is set, it will be used as the program to edit the function. If `$VISUAL` is unset but `$EDITOR` is set, that will be used. Otherwise, a built-in editor will be used. If there is no function called `NAME` a new function will be created with the specified name diff --git a/share/functions/funced.fish b/share/functions/funced.fish index e9248f879..6439e53fa 100644 --- a/share/functions/funced.fish +++ b/share/functions/funced.fish @@ -1,5 +1,11 @@ function funced --description 'Edit function definition' - set -l editor $EDITOR + set -l editor + # Check VISUAL first since theoretically EDITOR could be ed + if set -q VISUAL + set editor $VISUAL + else if set -q EDITOR + set editor $EDITOR + end set -l interactive set -l funcname while set -q argv[1]