aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
authorAdam Vandenberg2010-07-25 10:56:32 -0700
committerAdam Vandenberg2010-07-25 10:58:00 -0700
commit16bc177a4a894650809a1990fa6c8d184ba23d93 (patch)
treeafbb7de5ea03f35b94ba922365693a13dad0fde6 /Library/Homebrew/utils.rb
parent78ca4f35fbb3bc077d36b38b2a20c7392b950f38 (diff)
downloadbrew-16bc177a4a894650809a1990fa6c8d184ba23d93.tar.bz2
Allow HOMEBREW_EDITOR for non-project editing.
If set, use "HOMEBREW_EDITOR" when editing a single file, or multiple files in the same folder. Note that this setting does not affect `brew edit`, since opening all of Homebrew at once requires an editor with proper project support.
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 1fc8a9544..8b3d6fb79 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -140,11 +140,16 @@ def puts_columns items, cols = 4
end
def exec_editor *args
- editor=ENV['EDITOR']
+ editor = ENV['HOMEBREW_EDITOR'] || ENV['EDITOR']
if editor.nil?
if system "/usr/bin/which -s mate"
+ # TextMate
editor='mate'
+ elsif system "/usr/bin/which -s edit"
+ # BBEdit / TextWrangler
+ editor='edit'
else
+ # Default to vim
editor='/usr/bin/vim'
end
end