class EditorCommand

Constants

EDITOR_COMMANDS

Public Class Methods

new(editor: nil, command: nil) click to toggle source
# File lib/vimput/editor_command.rb, line 10
def initialize(editor: nil, command: nil)
  if editor && command
    raise ArgumentError.new('Pass only an editor or a command to Vimput, not both.')
  end

  @editor = editor&.to_sym
  @command = command
end

Public Instance Methods

text() click to toggle source
# File lib/vimput/editor_command.rb, line 19
def text
  if command = EDITOR_COMMANDS[@editor]
    command
  elsif @command
    @command
  else
    ENV["VISUAL"] || ENV["EDITOR"] || "vim"
  end
end