Commits

ZyX_I  committed 2c95e03

Initial version of command-t support (not working)

  • Participants
  • Parent commits f9b6fb5
  • Branches command-t

Comments (0)

Files changed (4)

File ftplugin/aurumlog.vim

     if len(files)==1
         let file=files[0]
     else
+        return s:F.rbgetfile(files)
         let choice=inputlist(['Select file (0 to cancel):']+
                     \        map(copy(files), '(v:key+1).". ".v:val'))
         if choice
     endif
     return file
 endfunction
+function s:F.rbgetfile(files)
+ruby << EOF
+require 'command-t/aurum_controller'
+require 'command-t/vim'
+$aurum_command_t = CommandT::AurumController.new
+EOF
+ruby $aurum_command_t.show_aurum_finder
+endfunction
 "▶1 gethexfile
 function s:F.gethexfile(...)
     let bvar=s:_r.bufvars[bufnr('%')]

File ruby/command-t/aurum_controller.rb

+require 'command-t/finder/aurum_finder'
+require 'command-t/controller'
+require 'command-t/vim'
+
+module CommandT
+    class AurumController < Controller
+        def show_aurum_finder
+            @path          = VIM::pwd
+            @active_finder = aurum_finder
+            show
+        end
+
+        def aurum_finder
+            @aurum_finder ||= CommandT::AurumFinder.new
+        end
+    end
+end

File ruby/command-t/finder/aurum_finder.rb

+require 'command-t/ext'
+require 'command-t/scanner/aurum_scanner'
+require 'command-t/finder'
+
+module CommandT
+    class AurumFinder < Finder
+        def initialize
+            @scanner = AurumScanner.new
+            @matcher = Matcher.new @scanner, :always_show_dot_files => true
+        end
+
+        def open_selection command, selection, options
+            ::VIM::evaluate "return #{selection}"
+        end
+    end
+end

File ruby/command-t/scanner/aurum_scanner.rb

+require 'command-t/scanner'
+
+module CommandT
+    class AurumScanner < Scanner
+        def paths
+            ::VIM::evaluate "a:files"
+        end
+    end
+end