summaryrefslogtreecommitdiff
path: root/scratch/piped_to_fzf.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-09-11 14:39:20 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-09-11 14:39:20 -0400
commit3316dcd7a3f77d9b37d0fb8a3db283e0a551e8d9 (patch)
treec128bbda27324c353e6f5544d9736dca57c4ac71 /scratch/piped_to_fzf.lua
parentd96d89711ca4a9534a7edb53b29eff4fd4ab1861 (diff)
scratch: add thoughts
Diffstat (limited to 'scratch/piped_to_fzf.lua')
-rw-r--r--scratch/piped_to_fzf.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/scratch/piped_to_fzf.lua b/scratch/piped_to_fzf.lua
new file mode 100644
index 0000000..98577bd
--- /dev/null
+++ b/scratch/piped_to_fzf.lua
@@ -0,0 +1,33 @@
+RELOAD('telescope')
+RELOAD('plenary')
+
+local finders = require('telescope.finders')
+local make_entry = require('telescope.make_entry')
+local pickers = require('telescope.pickers')
+local sorters = require('telescope.sorters')
+
+local Job = require('plenary.job')
+
+pickers.new {
+ prompt = "Piped FZF",
+
+ finder = finders._new {
+ fn_command = function(_, prompt)
+ return {
+ command = 'fzf',
+ args = {'--no-sort', '--filter', prompt or ''},
+
+ writer = Job:new {
+ command = 'rg',
+ args = {'--files'},
+ cwd = '/home/tj/',
+
+ enable_handlers = false,
+ },
+ }
+ end,
+
+ entry_maker = make_entry.gen_from_file(),
+ sorter = sorters.get_fuzzy_file(),
+ },
+}:find()