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.
This commit is contained in:
Adam Vandenberg 2010-07-25 10:56:32 -07:00
parent 78ca4f35fb
commit 16bc177a4a
3 changed files with 24 additions and 3 deletions

View File

@ -149,6 +149,14 @@ didn't include with OS X.
* HOMEBREW\_DEBUG:
If set, instructs Homebrew to always assume `--debug` when running commands.
* HOMEBREW\_EDITOR:
If set, Homebrew will use this editor when editing a single formula, or
several formulae in the same folder.
*NOTE*: `brew edit` will open all of Homebrew as discontinuous files and
folders. TextMate can handle this correctly in project mode, but many
editors will do strange things in this case.
* HOMEBREW\_SVN:
When exporting from Subversion, Homebrew will use `HOMEBREW_SVN` if set,
a Homebrew-built Subversion if installed, or the system-provided binary.
@ -165,7 +173,8 @@ didn't include with OS X.
configurations.)
* HOMEBREW\_USE\_LLVM:
If set, instructs Homebrew to use the LLVM front-ends to the GCC compilers.
If set, instructs Homebrew to use the LLVM front-ends to the GCC compilers.
*NOTE*: Not all formulae will build correctly under LLVM.
* HOMEBREW\_VERBOSE:

View File

@ -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

View File

@ -164,6 +164,13 @@ HOMEBREW_DEBUG
If set, instructs Homebrew to always assume \fB\-\-debug\fR when running commands\.
.
.TP
HOMEBREW_EDITOR
If set, Homebrew will use this editor when editing a single formula, or several formulae in the same folder\.
.
.IP
\fINOTE\fR: \fBbrew edit\fR will open all of Homebrew as discontinuous files and folders\. TextMate can handle this correctly in project mode, but many editors will do strange things in this case\.
.
.TP
HOMEBREW_SVN
When exporting from Subversion, Homebrew will use \fBHOMEBREW_SVN\fR if set, a Homebrew\-built Subversion if installed, or the system\-provided binary\.
.
@ -181,7 +188,7 @@ This issue typically occurs when using FileVault (or certain custom SSD configur
HOMEBREW_USE_LLVM
If set, instructs Homebrew to use the LLVM front\-ends to the GCC compilers\.
.
.br
.IP
\fINOTE\fR: Not all formulae will build correctly under LLVM\.
.
.TP