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
commit8c917dcf09aa9c7481b5279a7b09887425305cf3 (patch)
treeee5721b6a024aacd4ff8dd51f07edf18b2686724 /Library/Homebrew/utils.rb
parent0e7eae88d8746febfeb10495f9cf63caf8839781 (diff)
downloadhomebrew-8c917dcf09aa9c7481b5279a7b09887425305cf3.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