diff --git a/lua/telescope/builtin.lua b/lua/telescope/builtin.lua index 6b6ee8e..33728b2 100644 --- a/lua/telescope/builtin.lua +++ b/lua/telescope/builtin.lua @@ -233,4 +233,30 @@ builtin.grep_string = function(opts) } end +builtin.fzf_history = function() + local history_lines = table.concat(vim.v.oldfiles, '\n') + + local fzf = finders.new { + maximum_results = 1000, + fn_command = function(self, prompt) + return { + command = 'fzf', + args = {'--no-sort', '--filter', prompt}, + + writer = { + command = 'echo', + args = {history_lines}, + } + } + end + } + + local file_picker = pickers.new { } + + file_picker:find { + prompt = 'FZF History', + finder = fzf, + } +end + return builtin diff --git a/lua/telescope/finders.lua b/lua/telescope/finders.lua index 7866c87..700d6d0 100644 --- a/lua/telescope/finders.lua +++ b/lua/telescope/finders.lua @@ -129,6 +129,8 @@ function Finder:_find(prompt, process_result, process_complete) maximum_results = self.maximum_results, + writer = opts.writer and Job:new(opts.writer) or nil, + on_stdout = on_output, on_stderr = on_output,