diff --git a/bin/console b/bin/console index 7d0013c..dcb1b99 100755 --- a/bin/console +++ b/bin/console @@ -16,4 +16,5 @@ RelinePac.configure do |config| end end +ARGV << '-f' IRB.start(__FILE__) diff --git a/lib/reline_pac/packages/history.rb b/lib/reline_pac/packages/history.rb index 0ea758c..c7bfd67 100644 --- a/lib/reline_pac/packages/history.rb +++ b/lib/reline_pac/packages/history.rb @@ -12,7 +12,7 @@ def fzf_history(_key) return if all_history.empty? seen = {} - filtered = all_history.filter_map do |h| + filtered = all_history.reverse.filter_map do |h| stripped = h.strip next if stripped.empty? || seen[stripped] @@ -23,7 +23,7 @@ def fzf_history(_key) display = filtered.map { |h| h.gsub("\n", '⏎') } selected_index = nil - ::IO.popen("fzf --tac --reverse --border --query='#{line}' --with-nth=1 --delimiter=$'\\t'", 'r+') do |io| + ::IO.popen("fzf --reverse --border --query='#{line}' --with-nth=1 --delimiter=$'\\t'", 'r+') do |io| display.each_with_index { |d, i| io.puts "#{d}\t#{i}" } io.close_write result = io.read.strip