From f2fcdcb6751701db94236d534db72346f7c118d6 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Fri, 28 Aug 2020 00:19:10 -0400 Subject: feat: borders and no previews for rocker --- lua/telescope/builtin.lua | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) (limited to 'lua/telescope/builtin.lua') 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("") + + 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 -- cgit v1.2.3