Respect $VISUAL when picking an editor

This commit is contained in:
Jack Nagel 2013-07-09 20:12:53 -05:00
parent a90ec1ae80
commit 81984411b0
3 changed files with 16 additions and 9 deletions

View File

@ -64,8 +64,8 @@ Note that these flags should only appear after a command.
deleted. If you want to delete those too: `rm -rf $(brew --cache)` deleted. If you want to delete those too: `rm -rf $(brew --cache)`
* `create [--autotools|--cmake] [--no-fetch] [--set-name <name>] [--set-version <version>]` <URL>: * `create [--autotools|--cmake] [--no-fetch] [--set-name <name>] [--set-version <version>]` <URL>:
Generate a formula for the downloadable file at <URL> and open it in Generate a formula for the downloadable file at <URL> and open it in the editor.
`EDITOR`. Homebrew will attempt to automatically derive the formula name Homebrew will attempt to automatically derive the formula name
and version, but if it fails, you'll have to make your own template. The wget and version, but if it fails, you'll have to make your own template. The wget
formula serves as a simple example. formula serves as a simple example.
@ -109,7 +109,7 @@ Note that these flags should only appear after a command.
Open all of Homebrew for editing. Open all of Homebrew for editing.
* `edit` <formula>: * `edit` <formula>:
Open <formula> in `EDITOR`. Open <formula> in the editor.
* `fetch [--force] [-v] [--HEAD] [--deps]` <formulae>: * `fetch [--force] [-v] [--HEAD] [--deps]` <formulae>:
Download the source packages for the given <formulae>. Download the source packages for the given <formulae>.
@ -408,7 +408,7 @@ can take several different forms:
when opening project homepages. when opening project homepages.
* EDITOR: * EDITOR:
If set, and `HOMEBREW_EDITOR` is not, use `EDITOR` as the text editor. If set, and `HOMEBREW_EDITOR` and `VISUAL` are not, use `EDITOR` as the text editor.
* GIT: * GIT:
When using Git, Homebrew will use `GIT` if set, When using Git, Homebrew will use `GIT` if set,
@ -516,6 +516,9 @@ can take several different forms:
* HOMEBREW\_VERBOSE: * HOMEBREW\_VERBOSE:
If set, Homebrew always assumes `--verbose` when running commands. If set, Homebrew always assumes `--verbose` when running commands.
* VISUAL:
If set, and `HOMEBREW_EDITOR` is not, use `VISUAL` as the text editor.
## USING HOMEBREW BEHIND A PROXY ## USING HOMEBREW BEHIND A PROXY
Homebrew uses several commands for downloading files (e.g. curl, git, svn). Homebrew uses several commands for downloading files (e.g. curl, git, svn).

View File

@ -171,7 +171,7 @@ def which cmd
end end
def which_editor def which_editor
editor = ENV['HOMEBREW_EDITOR'] || ENV['EDITOR'] editor = ENV.values_at('HOMEBREW_EDITOR', 'VISUAL', 'EDITOR').compact.first
# If an editor wasn't set, try to pick a sane default # If an editor wasn't set, try to pick a sane default
return editor unless editor.nil? return editor unless editor.nil?

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BREW" "1" "June 2013" "Homebrew" "brew" .TH "BREW" "1" "July 2013" "Homebrew" "brew"
. .
.SH "NAME" .SH "NAME"
\fBbrew\fR \- The missing package manager for OS X \fBbrew\fR \- The missing package manager for OS X
@ -72,7 +72,7 @@ If \fB\-s\fR is passed, scrubs the cache, removing downloads for even the latest
. .
.TP .TP
\fBcreate [\-\-autotools|\-\-cmake] [\-\-no\-fetch] [\-\-set\-name <name>] [\-\-set\-version <version>]\fR \fIURL\fR \fBcreate [\-\-autotools|\-\-cmake] [\-\-no\-fetch] [\-\-set\-name <name>] [\-\-set\-version <version>]\fR \fIURL\fR
Generate a formula for the downloadable file at \fIURL\fR and open it in \fBEDITOR\fR\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The wget formula serves as a simple example\. Generate a formula for the downloadable file at \fIURL\fR and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The wget formula serves as a simple example\.
. .
.IP .IP
If \fB\-\-autotools\fR is passed, create a basic template for an Autotools\-style build\. If \fB\-\-cmake\fR is passed, create a basic template for a CMake\-style build\. If \fB\-\-autotools\fR is passed, create a basic template for an Autotools\-style build\. If \fB\-\-cmake\fR is passed, create a basic template for a CMake\-style build\.
@ -122,7 +122,7 @@ Open all of Homebrew for editing\.
. .
.TP .TP
\fBedit\fR \fIformula\fR \fBedit\fR \fIformula\fR
Open \fIformula\fR in \fBEDITOR\fR\. Open \fIformula\fR in the editor\.
. .
.TP .TP
\fBfetch [\-\-force] [\-v] [\-\-HEAD] [\-\-deps]\fR \fIformulae\fR \fBfetch [\-\-force] [\-v] [\-\-HEAD] [\-\-deps]\fR \fIformulae\fR
@ -448,7 +448,7 @@ If set, and \fBHOMEBREW_BROWSER\fR is not, use \fBBROWSER\fR as the web browser
. .
.TP .TP
EDITOR EDITOR
If set, and \fBHOMEBREW_EDITOR\fR is not, use \fBEDITOR\fR as the text editor\. If set, and \fBHOMEBREW_EDITOR\fR and \fBVISUAL\fR are not, use \fBEDITOR\fR as the text editor\.
. .
.TP .TP
GIT GIT
@ -561,6 +561,10 @@ If set, forces Homebrew to compile using LLVM\.
HOMEBREW_VERBOSE HOMEBREW_VERBOSE
If set, Homebrew always assumes \fB\-\-verbose\fR when running commands\. If set, Homebrew always assumes \fB\-\-verbose\fR when running commands\.
. .
.TP
VISUAL
If set, and \fBHOMEBREW_EDITOR\fR is not, use \fBVISUAL\fR as the text editor\.
.
.SH "USING HOMEBREW BEHIND A PROXY" .SH "USING HOMEBREW BEHIND A PROXY"
Homebrew uses several commands for downloading files (e\.g\. curl, git, svn)\. Many of these tools can download via a proxy\. It\'s common for these tools to read proxy parameters from environment variables\. Homebrew uses several commands for downloading files (e\.g\. curl, git, svn)\. Many of these tools can download via a proxy\. It\'s common for these tools to read proxy parameters from environment variables\.
. .