Class: VER::Executor::ExPath

Inherits:
VER::Entry
  • Object
show all
Defined in:
lib/ver/executor/path.rb

Overview

Open or focus a buffer with the given path.

Direct Known Subclasses

ExWrite

Constant Summary

Constants inherited from VER::Entry

VER::Entry::BACKWARD_WORD, VER::Entry::FORWARD_WORD

Instance Method Summary collapse

Methods inherited from VER::Entry

#accept_line, #beginning_of_history, #cursor=, #delete, #delete_next_char, #delete_next_word, #delete_prev_char, #delete_prev_word, #deleting, #end_of_history, #end_of_line, #error, #event, #events, #insert, #insert_selection, #insert_string, #insert_tab, #kill, #kill_end_of_line, #killing, #message, #next_char, #next_history, #next_word, #paste, #prev_char, #prev_word, #previous_history, #sel_end_of_line, #sel_next_char, #sel_next_word, #sel_prev_char, #sel_prev_word, #sel_start_of_line, #start_of_line, #style, #transpose_chars, #value=, #virtual_movement

Instance Method Details

#action(selected) ⇒ Object



19
20
21
22
23
24
# File 'lib/ver/executor/path.rb', line 19

def action(selected)
  path = selected || value
  throw(:invalid) if File.directory?(path)
  VER.find_or_create_buffer(path)
  callback.destroy(false)
end

#choices(origin) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ver/executor/path.rb', line 5

def choices(origin)
  origin = origin.sub(/^.*\/\//, '/')
  origin = origin.sub(/^.*\/~\//, '~/')
  origin = File.expand_path(origin) unless File.directory?(origin)

  Dir.glob("#{origin}*").map do |path|
    if File.directory?(path)
      "#{path}/"
    else
      path
    end
  end
end