Sha256: 21c5e433e712850a5ee48931807fa20dcb4cfd5e0466551d618a3c9c9d664ad7

Contents?: true

Size: 580 Bytes

Versions: 5

Compression:

Stored size: 580 Bytes

Contents

# frozen_string_literal: true

module Textbringer
  class BufferListMode < Mode
    BUFFER_LIST_MODE_MAP = Keymap.new
    BUFFER_LIST_MODE_MAP.define_key("\C-m", :this_window_command)

    def initialize(buffer)
      super(buffer)
      buffer.keymap = BUFFER_LIST_MODE_MAP
    end

    define_local_command(:this_window,
                         doc: "Change the current account.") do
      name = @buffer.save_excursion {
        @buffer.beginning_of_line
        @buffer.looking_at?(/.*/)
        @buffer.match_string(0)
      }
      switch_to_buffer(name)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
textbringer-1.0.0 lib/textbringer/modes/buffer_list_mode.rb
textbringer-0.3.2 lib/textbringer/modes/buffer_list_mode.rb
textbringer-0.3.1 lib/textbringer/modes/buffer_list_mode.rb
textbringer-0.3.0 lib/textbringer/modes/buffer_list_mode.rb
textbringer-0.2.9 lib/textbringer/modes/buffer_list_mode.rb