In Files

  • reline/config.rb

Reline::Config

Attributes

test_mode[R]

Public Class Methods

new() click to toggle source
 
               # File reline/config.rb, line 48
def initialize
  @additional_key_bindings = {} # from inputrc
  @additional_key_bindings[:emacs] = {}
  @additional_key_bindings[:vi_insert] = {}
  @additional_key_bindings[:vi_command] = {}
  @oneshot_key_bindings = {}
  @skip_section = nil
  @if_stack = nil
  @editing_mode_label = :emacs
  @keymap_label = :emacs
  @key_actors = {}
  @key_actors[:emacs] = Reline::KeyActor::Emacs.new
  @key_actors[:vi_insert] = Reline::KeyActor::ViInsert.new
  @key_actors[:vi_command] = Reline::KeyActor::ViCommand.new
  @vi_cmd_mode_string = '(cmd)'
  @vi_ins_mode_string = '(ins)'
  @emacs_mode_string = '@'
  # https://tiswww.case.edu/php/chet/readline/readline.html#IDX25
  @history_size = -1 # unlimited
  @keyseq_timeout = 500
  @test_mode = false
  @autocompletion = false
  @convert_meta = true if seven_bit_encoding?(Reline::IOGate.encoding)
end
            

Public Instance Methods

autocompletion() click to toggle source
 
               # File reline/config.rb, line 100
def autocompletion
  @autocompletion
end
            
autocompletion=(val) click to toggle source
 
               # File reline/config.rb, line 96
def autocompletion=(val)
  @autocompletion = val
end
            
editing_mode() click to toggle source
 
               # File reline/config.rb, line 84
def editing_mode
  @key_actors[@editing_mode_label]
end
            
editing_mode=(val) click to toggle source
 
               # File reline/config.rb, line 88
def editing_mode=(val)
  @editing_mode_label = val
end
            
editing_mode_is?(*val) click to toggle source
 
               # File reline/config.rb, line 92
def editing_mode_is?(*val)
  (val.respond_to?(:any?) ? val : [val]).any?(@editing_mode_label)
end
            
inputrc_path() click to toggle source
 
               # File reline/config.rb, line 108
def inputrc_path
  case ENV['INPUTRC']
  when nil, ''
  else
    return File.expand_path(ENV['INPUTRC'])
  end

  # In the XDG Specification, if ~/.config/readline/inputrc exists, then
  # ~/.inputrc should not be read, but for compatibility with GNU Readline,
  # if ~/.inputrc exists, then it is given priority.
  home_rc_path = File.expand_path('~/.inputrc')
  return home_rc_path if File.exist?(home_rc_path)

  case path = ENV['XDG_CONFIG_HOME']
  when nil, ''
  else
    path = File.join(path, 'readline/inputrc')
    return path if File.exist?(path) and path == File.expand_path(path)
  end

  path = File.expand_path('~/.config/readline/inputrc')
  return path if File.exist?(path)

  return home_rc_path
end
            
keymap() click to toggle source
 
               # File reline/config.rb, line 104
def keymap
  @key_actors[@keymap_label]
end
            
reset() click to toggle source
 
               # File reline/config.rb, line 73
def reset
  if editing_mode_is?(:vi_command)
    @editing_mode_label = :vi_insert
  end
  @additional_key_bindings.keys.each do |key|
    @additional_key_bindings[key].clear
  end
  @oneshot_key_bindings.clear
  reset_default_key_bindings
end
            
There is an updated format of the API docs for this version here.