aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
authorMike McQuaid2017-06-07 16:07:40 +0100
committerMike McQuaid2017-06-07 16:07:53 +0100
commit486d3d84b1b6f39309810a6ea55d1f72a5c8155b (patch)
treea7a12401d948b4790a1e624e94b7d40145b0f671 /Library/Homebrew/utils.rb
parentcfc40196f22fd07cf62a6f51ee22915485bb4c09 (diff)
downloadbrew-486d3d84b1b6f39309810a6ea55d1f72a5c8155b.tar.bz2
edit: tweak default editors.
Add `atom` (not my editor of choice [TextMate for life!]) but widely used enough to probably warrant it. Also, reorder based on my best guestimates of current usage and cleanup the editor code while we're here.
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb23
1 files changed, 9 insertions, 14 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index cde2ee306..826cf4c5c 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -328,21 +328,16 @@ def which_all(cmd, path = ENV["PATH"])
end
def which_editor
- editor = ENV.values_at("HOMEBREW_EDITOR", "HOMEBREW_VISUAL").compact.reject(&:empty?).first
- return editor unless editor.nil?
-
- # Find Textmate, BBEdit / TextWrangler, or vim
- %w[mate edit vim].each do |candidate|
- editor = candidate if which(candidate, ENV["HOMEBREW_PATH"])
+ editor = ENV.values_at("HOMEBREW_EDITOR", "HOMEBREW_VISUAL")
+ .compact
+ .reject(&:empty?)
+ .first
+ return editor if editor
+
+ # Find Atom, Sublime Text, Textmate, BBEdit / TextWrangler, or vim
+ editor = %w[atom subl mate edit vim].find do |candidate|
+ candidate if which(candidate, ENV["HOMEBREW_PATH"])
end
-
- # Find Textmate
- editor = which("mate", ENV["HOMEBREW_PATH"])
- # Find BBEdit/TextWrangler
- editor ||= which("edit", ENV["HOMEBREW_PATH"])
- # Find vim
- editor ||= which("vim", ENV["HOMEBREW_PATH"])
- # Default to standard vim
editor ||= "/usr/bin/vim"
opoo <<-EOS.undent