Sha256: 21d1dc74db6bb4daebcd5803477008b03cf79545a0091c0d0b6a3f93e4923a2b

Contents?: true

Size: 712 Bytes

Versions: 1

Compression:

Stored size: 712 Bytes

Contents

require 'amun/event_manager'
require 'amun/buffer'
require 'amun/windows/mini_buffer_window'

def find_file(*)
  Amun::Windows::MiniBufferWindow.new('Open file: ', Dir.pwd) do |window|
    file_path = window.buffer.to_s

    file_buffer = Amun::Buffer.new(file_path, File.open(file_path, 'r+'))
    Amun::Buffer.instances << file_buffer
    Amun::Buffer.current = file_buffer
  end.attach(Amun::Application.frame)

  true
end

Amun::EventManager.bind "\C-x \C-f", nil, :find_file

unless ARGV.empty?
  ARGV.each do |file|
    file_buffer = Amun::Buffer.new(file, File.open(file, 'r+'))
    Amun::Buffer.instances << file_buffer
    Amun::Buffer.current = file_buffer
    Amun::Application.frame.render
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amun-0.2.0 lib/amun/features/files.rb