feat: borders and no previews for rocker

This commit is contained in:
TJ DeVries
2020-08-28 00:19:10 -04:00
parent d20be453a8
commit f2fcdcb675
4 changed files with 65 additions and 18 deletions

View File

@@ -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