Method: Pry::Editor.default

Defined in:
lib/pry/editor.rb

.defaultObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/pry/editor.rb', line 7

def self.default
  if (visual = Pry::Env['VISUAL'])
    return visual
  end

  if (editor = Pry::Env['EDITOR'])
    return editor
  end

  return 'notepad' if Helpers::Platform.windows?

  %w[editor nano vi].find do |editor_exe|
    Kernel.system("which #{editor_exe} > /dev/null 2>&1")
  end
end