diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-08-28 00:19:10 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-08-28 00:19:10 -0400 |
| commit | f2fcdcb6751701db94236d534db72346f7c118d6 (patch) | |
| tree | baa700549805f8ca969f3acdb29eaeb6af8f273f /lua/telescope/builtin.lua | |
| parent | d20be453a82b7fc6e54c8424133218b4032962a7 (diff) | |
feat: borders and no previews for rocker
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 |
