aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 46a8cc68e..f37b777ee 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -320,21 +320,21 @@ def which_all(cmd, path = ENV["PATH"])
end
def which_editor
- editor = ENV.values_at("HOMEBREW_EDITOR", "VISUAL", "EDITOR").compact.first
- return editor unless editor.nil?
+ editor = ENV.values_at("HOMEBREW_EDITOR", "VISUAL").compact.reject(&:empty?).first
+ return which(editor, ENV["HOMEBREW_PATH"]) unless editor.nil?
# Find Textmate
- editor = "mate" if which "mate"
+ editor = which("mate", ENV["HOMEBREW_PATH"])
# Find BBEdit / TextWrangler
- editor ||= "edit" if which "edit"
+ editor ||= which("edit", ENV["HOMEBREW_PATH"])
# Find vim
- editor ||= "vim" if which "vim"
+ editor ||= which("vim", ENV["HOMEBREW_PATH"])
# Default to standard vim
editor ||= "/usr/bin/vim"
opoo <<-EOS.undent
Using #{editor} because no editor was set in the environment.
- This may change in the future, so we recommend setting EDITOR, VISUAL,
+ This may change in the future, so we recommend setting EDITOR,
or HOMEBREW_EDITOR to your preferred text editor.
EOS