Merge pull request #2749 from MikeMcQuaid/edit-default-editors
edit: tweak default editors.
This commit is contained in:
commit
fd4aaf030f
@ -21,8 +21,8 @@ module Homebrew
|
||||
# If no brews are listed, open the project root in an editor.
|
||||
if ARGV.named.empty?
|
||||
editor = File.basename which_editor
|
||||
if ["mate", "subl"].include?(editor)
|
||||
# If the user is using TextMate or Sublime Text,
|
||||
if ["atom", "subl", "mate"].include?(editor)
|
||||
# If the user is using Atom, Sublime Text or TextMate
|
||||
# give a nice project view instead.
|
||||
exec_editor HOMEBREW_REPOSITORY/"bin/brew",
|
||||
HOMEBREW_REPOSITORY/"README.md",
|
||||
|
||||
@ -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?
|
||||
editor = ENV.values_at("HOMEBREW_EDITOR", "HOMEBREW_VISUAL")
|
||||
.compact
|
||||
.reject(&:empty?)
|
||||
.first
|
||||
return editor if editor
|
||||
|
||||
# Find Textmate, BBEdit / TextWrangler, or vim
|
||||
%w[mate edit vim].each do |candidate|
|
||||
editor = candidate if which(candidate, ENV["HOMEBREW_PATH"])
|
||||
# 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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user