diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-02 00:06:03 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-09-02 00:06:07 -0400 |
| commit | 061307233cdff0a90504117dd48e4fec3a10443a (patch) | |
| tree | d71cd84a3eb93fda55284b22be3eb610aaced13a /media/demo_script_2.lua | |
| parent | 9f906f03922907b95b71a8f57254e64ba9c76ce8 (diff) | |
feat: add some new items and make mappings easier
Diffstat (limited to 'media/demo_script_2.lua')
| -rw-r--r-- | media/demo_script_2.lua | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/media/demo_script_2.lua b/media/demo_script_2.lua new file mode 100644 index 0000000..9394ffc --- /dev/null +++ b/media/demo_script_2.lua @@ -0,0 +1,30 @@ +local finders = require('telescope.finders') +local previewers = require('telescope.previewers') +local pickers = require('telescope.pickers') + +-- Create a new finder. +-- This finder, rather than taking a Lua list, +-- generates a shell command that should be run. +-- +-- Each line of the shell command is converted to an entry, +-- and is possible to preview with builtin previews. +-- +-- In this example, we use ripgrep to search over your entire directory +-- live as you type. +local live_grepper = finders.new_job(function(prompt) + if not prompt or prompt == "" then + return nil + end + + return { 'rg', "--vimgrep", prompt} +end) + +-- Create and run the Picker. +-- +-- NOTE: No sorter is needed to be passed. +-- Results will be returned in the order they are received. +pickers.new({ + prompt = 'Live Grep', + finder = live_grepper, + previewer = previewers.vimgrep, +}):find() |
