From 16bc177a4a894650809a1990fa6c8d184ba23d93 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Sun, 25 Jul 2010 10:56:32 -0700 Subject: 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. --- Library/Homebrew/utils.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew') 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 -- cgit v1.2.3