diff options
Diffstat (limited to 'lua/telescope/builtin.lua')
| -rw-r--r-- | lua/telescope/builtin.lua | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/lua/telescope/builtin.lua b/lua/telescope/builtin.lua index a1e8437..89dcbf1 100644 --- a/lua/telescope/builtin.lua +++ b/lua/telescope/builtin.lua @@ -11,13 +11,7 @@ local sorters = require('telescope.sorters') local builtin = {} -local ifnil = function(x, was_nil, was_not_nil) - if x == nil then - return was_nil - else - return was_not_nil - end -end +local ifnil = function(x, was_nil, was_not_nil) if x == nil then return was_nil else return was_not_nil end end builtin.git_files = function(opts) opts = opts or {} @@ -52,6 +46,9 @@ builtin.git_files = function(opts) prompt = 'Simple File', finder = file_finder, sorter = file_sorter, + + border = opts.border, + borderchars = opts.borderchars, } end @@ -207,6 +204,36 @@ builtin.quickfix = function() } end +builtin.grep_string = function(opts) + opts = opts or {} + + local search = opts.search or vim.fn.expand("<cword>") + + local grepper = finders.new { + maximum_results = 10000, + + -- TODO: We can optimize these. + -- static = true, + + fn_command = function() + return { + command = 'rg', + args = {"--vimgrep", search}, + } + end + } + + local file_picker = pickers.new { + previewer = previewers.vimgrep + } + + file_picker:find { + prompt = 'Live Grep', + finder = grepper, + sorter = sorters.get_norcalli_sorter(), + } +end + return builtin |
