Class: CommandT::Finder::HistoryFinder

Inherits:
CommandT::Finder show all
Defined in:
lib/command-t/finder/history_finder.rb

Instance Method Summary collapse

Methods inherited from CommandT::Finder

#path=, #sorted_matches_for

Constructor Details

#initialize(options = {}) ⇒ HistoryFinder

Returns a new instance of HistoryFinder.



7
8
9
10
11
# File 'lib/command-t/finder/history_finder.rb', line 7

def initialize(options = {})
  @history_type = options[:history_type] # / or :
  @scanner = Scanner::HistoryScanner.new("silent history #{@history_type}")
  @matcher = Matcher.new @scanner, :always_show_dot_files => true
end

Instance Method Details

#flushObject



25
# File 'lib/command-t/finder/history_finder.rb', line 25

def flush; end

#nameObject



27
28
29
# File 'lib/command-t/finder/history_finder.rb', line 27

def name
  @history_type == ':' ? 'History' : 'Searches'
end

#open_selection(command, selection, options = {}) ⇒ Object



13
14
15
16
# File 'lib/command-t/finder/history_finder.rb', line 13

def open_selection(command, selection, options = {})
  escaped = VIM.escape_for_single_quotes(selection)
  ::VIM::command "call feedkeys('#{@history_type}#{escaped} ', 'nt')"
end

#prepare_selection(selection) ⇒ Object



18
19
20
21
22
23
# File 'lib/command-t/finder/history_finder.rb', line 18

def prepare_selection(selection)
  # Pass selection through as-is, bypassing path-based stuff that the
  # controller would otherwise do, like `expand_path`,
  # `sanitize_path_string` and `relative_path_under_working_directory`.
  selection
end