Class: CommandT::Finder::MRUBufferFinder
- Inherits:
-
BufferFinder
- Object
- CommandT::Finder
- BufferFinder
- CommandT::Finder::MRUBufferFinder
- Defined in:
- lib/command-t/finder/mru_buffer_finder.rb
Instance Method Summary collapse
-
#initialize ⇒ MRUBufferFinder
constructor
A new instance of MRUBufferFinder.
- #name ⇒ Object
-
#sorted_matches_for(str, options = {}) ⇒ Object
Override sorted_matches_for to prevent MRU ordered matches from being ordered alphabetically.
Methods inherited from CommandT::Finder
Constructor Details
#initialize ⇒ MRUBufferFinder
Returns a new instance of MRUBufferFinder.
7 8 9 10 |
# File 'lib/command-t/finder/mru_buffer_finder.rb', line 7 def initialize @scanner = Scanner::MRUBufferScanner.new @matcher = Matcher.new @scanner, :always_show_dot_files => true end |
Instance Method Details
#name ⇒ Object
29 30 31 |
# File 'lib/command-t/finder/mru_buffer_finder.rb', line 29 def name 'Recent' end |
#sorted_matches_for(str, options = {}) ⇒ Object
Override sorted_matches_for to prevent MRU ordered matches from being ordered alphabetically.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/command-t/finder/mru_buffer_finder.rb', line 14 def sorted_matches_for(str, = {}) matches = super(str, .merge(:sort => false)) # Take current buffer (by definition, the most recently used) and move it # to the end of the results. if MRU.last && relative_path_under_working_directory( ::VIM.evaluate("bufname(#{MRU.last})") ) == matches.first matches[1..-1] + [matches.first] else matches end end |