class FileSelector
Public Class Methods
new()
click to toggle source
# File lib/vimamsa/search_replace.rb, line 9 def initialize() @buf = nil end
Public Instance Methods
dir_to_buf(dirpath, b = nil)
click to toggle source
# File lib/vimamsa/search_replace.rb, line 20 def dir_to_buf(dirpath, b = nil) @ld = dirpath @dlist = Dir.children(@ld) @cdirs = [] @cfiles = [] for x in @dlist if File.directory?(fullp(x)) @cdirs << x else @cfiles << x end end s = "..\n" s << @cdirs.join("\n") s << @cfiles.join("\n") if @buf.nil? @buf = create_new_file(nil, s) @buf.module = self @buf.active_kbd_mode = :file_exp else @buf.set_content(s) end end
fullp(fn)
click to toggle source
# File lib/vimamsa/search_replace.rb, line 45 def fullp(fn) "#{@ld}/#{fn}" end
run()
click to toggle source
# File lib/vimamsa/search_replace.rb, line 13 def run ld = buflist.get_last_dir dir_to_buf(ld) # puts "ld=#{ld}" # dlist = Dir["#{ld}/*"] end
select_line()
click to toggle source
# File lib/vimamsa/search_replace.rb, line 49 def select_line # puts "def select_line" fn = fullp(@buf.get_current_line[0..-2]) if File.directory?(fn) puts "CHDIR: #{fn}" dir_to_buf(fn) # elsif vma.can_open_extension?(fn) #TODO: remove this check? # jump_to_file(fn) elsif file_is_text_file(fn) jump_to_file(fn) else open_with_default_program(fn) end # puts l.inspect end