summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-09-10 11:11:14 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-09-10 11:11:17 -0400
commite1ded1a01db26296d89f3353ee1f152e97629df1 (patch)
treed4a0c971b9dae40d21453b1eeb442bba9a3a3488 /lua
parent5a3b76b9ed884e73d32eabae0d2bed327f55ec1d (diff)
Allow easily changing grep arguments
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/builtin.lua9
-rw-r--r--lua/telescope/config.lua6
2 files changed, 10 insertions, 5 deletions
diff --git a/lua/telescope/builtin.lua b/lua/telescope/builtin.lua
index 9adeba5..6e266cd 100644
--- a/lua/telescope/builtin.lua
+++ b/lua/telescope/builtin.lua
@@ -29,12 +29,11 @@ local pickers = require('telescope.pickers')
local sorters = require('telescope.sorters')
local utils = require('telescope.utils')
+local conf = require('telescope.config').values
+
local filter = vim.tbl_filter
local flatten = vim.tbl_flatten
--- TODO: Support silver search here.
--- TODO: Support normal grep here (in case neither are installed).
-local vimgrep_arguments = {'rg', '--color=never', '--no-heading', '--with-filename', '--line-number', '--column'}
local builtin = {}
@@ -67,7 +66,7 @@ builtin.live_grep = function(opts)
return nil
end
- return flatten { vimgrep_arguments, prompt }
+ return flatten { conf.vimgrep_arguments, prompt }
end,
opts.entry_maker or make_entry.gen_from_vimgrep(opts),
opts.max_results or 1000
@@ -225,7 +224,7 @@ builtin.grep_string = function(opts)
pickers.new(opts, {
prompt = 'Find Word',
finder = finders.new_oneshot_job(
- flatten { vimgrep_arguments, search},
+ flatten { conf.vimgrep_arguments, search},
opts
),
previewer = previewers.vimgrep.new(opts),
diff --git a/lua/telescope/config.lua b/lua/telescope/config.lua
index 9e1c337..c42e500 100644
--- a/lua/telescope/config.lua
+++ b/lua/telescope/config.lua
@@ -38,6 +38,12 @@ function config.set_defaults(defaults)
set("width", 0.75)
set("winblend", 0)
+ -- Builtin configuration
+
+ -- List that will be executed.
+ -- Last argument will be the search term (passed in during execution)
+ set("vimgrep_arguments", {'rg', '--color=never', '--no-heading', '--with-filename', '--line-number', '--column'})
+
-- TODO: Shortenpath
-- Decide how to propagate that to all the opts everywhere.