diff options
| author | Mike McQuaid | 2017-06-08 12:46:56 +0300 |
|---|---|---|
| committer | GitHub | 2017-06-08 12:46:56 +0300 |
| commit | fd4aaf030f7e6c356239af55e0a1b72c3f290706 (patch) | |
| tree | 8803086ece7359977d2e1c5b04c54c807839acdc /Library/Homebrew/utils.rb | |
| parent | 8b29a07cfafd6139c325bd8449a9d10ebcb89ca5 (diff) | |
| parent | 486d3d84b1b6f39309810a6ea55d1f72a5c8155b (diff) | |
| download | brew-fd4aaf030f7e6c356239af55e0a1b72c3f290706.tar.bz2 | |
Merge pull request #2749 from MikeMcQuaid/edit-default-editors
edit: tweak default editors.
Diffstat (limited to 'Library/Homebrew/utils.rb')
| -rw-r--r-- | Library/Homebrew/utils.rb | 23 |
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 |
