accept QWANDRY_EDITOR variable to allow no-wait mode for subl, mate, etc

This commit is contained in:
Jay Levitt 2012-07-23 15:20:28 -04:00
parent f58514cee1
commit 0aa962ac03

View File

@ -25,10 +25,10 @@ module Qwandry
# Launches a Package or path represented by a String. Unless `editor` will
# check against the environment by default.
def launch(package, editor=nil)
editor ||= @editor || ENV['VISUAL'] || ENV['EDITOR']
editor ||= @editor || ENV['QWANDRY_EDITOR'] || ENV['VISUAL'] || ENV['EDITOR']
if (!editor) || (editor =~ /^\s*$/) # if the editor is not set, or is blank, exit with a message:
puts "Please either set EDITOR or pass in an editor to use"
puts "Please set QWANDRY_EDITOR, VISUAL or EDITOR, or pass in an editor to use"
exit 1
end