Class: CommandT::Finder
- Inherits:
-
Object
- Object
- CommandT::Finder
- Includes:
- PathUtilities
- Defined in:
- lib/command-t/finder.rb,
lib/command-t/finder/tag_finder.rb,
lib/command-t/finder/file_finder.rb,
lib/command-t/finder/help_finder.rb,
lib/command-t/finder/jump_finder.rb,
lib/command-t/finder/line_finder.rb,
lib/command-t/finder/buffer_finder.rb,
lib/command-t/finder/command_finder.rb,
lib/command-t/finder/history_finder.rb,
lib/command-t/finder/mru_buffer_finder.rb
Overview
Encapsulates a Scanner instance (which builds up a list of available files in a directory) and a Matcher instance (which selects from that list based on a search string).
Specialized subclasses use different kinds of scanners adapted for different kinds of search (files, buffers).
Direct Known Subclasses
BufferFinder, CommandFinder, FileFinder, HelpFinder, HistoryFinder, JumpFinder, LineFinder, TagFinder
Defined Under Namespace
Classes: BufferFinder, CommandFinder, FileFinder, HelpFinder, HistoryFinder, JumpFinder, LineFinder, MRUBufferFinder, TagFinder
Instance Method Summary collapse
-
#initialize(path = Dir.pwd, options = {}) ⇒ Finder
constructor
A new instance of Finder.
-
#name ⇒ Object
Returns a human-readable name describing the finder, for display in the statusline attached to the MatchWindow buffer.
- #open_selection(command, selection, options = {}) ⇒ Object
- #path=(path) ⇒ Object
-
#sorted_matches_for(str, options = {}) ⇒ Object
Options: :limit (integer): limit the number of returned matches.
Constructor Details
#initialize(path = Dir.pwd, options = {}) ⇒ Finder
Returns a new instance of Finder.
26 27 28 |
# File 'lib/command-t/finder.rb', line 26 def initialize(path = Dir.pwd, = {}) raise RuntimeError, 'Subclass responsibility' end |
Instance Method Details
#name ⇒ Object
Returns a human-readable name describing the finder, for display in the statusline attached to the MatchWindow buffer.
32 33 34 |
# File 'lib/command-t/finder.rb', line 32 def name raise RuntimeError, 'Subclass responsibility' end |
#open_selection(command, selection, options = {}) ⇒ Object
42 43 44 |
# File 'lib/command-t/finder.rb', line 42 def open_selection(command, selection, = {}) ::VIM::command "silent #{command} #{selection}" end |
#path=(path) ⇒ Object
46 47 48 |
# File 'lib/command-t/finder.rb', line 46 def path=(path) @scanner.path = path end |
#sorted_matches_for(str, options = {}) ⇒ Object
Options:
:limit (integer): limit the number of returned matches
38 39 40 |
# File 'lib/command-t/finder.rb', line 38 def sorted_matches_for(str, = {}) @matcher.sorted_matches_for str, end |