feat: Add support for ripgrep in "find_files" builtin (#70)
* feat: Add support for ripgrep in "find_files" builtin * docs: Add mention about "ripgrep" for find_files builtin
This commit is contained in:
@@ -11,7 +11,7 @@ Support for:
|
|||||||
* LSP (references, document symbols, workspace symbols)
|
* LSP (references, document symbols, workspace symbols)
|
||||||
* Treesitter
|
* Treesitter
|
||||||
* Grep
|
* Grep
|
||||||
* Files (git, fd)
|
* Files (git, fd, rg)
|
||||||
* Vim (command history, quickfix, loclist)
|
* Vim (command history, quickfix, loclist)
|
||||||
|
|
||||||
[What is Telescope?](https://www.twitch.tv/teej_dv/clip/RichDistinctPlumberPastaThat)
|
[What is Telescope?](https://www.twitch.tv/teej_dv/clip/RichDistinctPlumberPastaThat)
|
||||||
|
|||||||
@@ -366,15 +366,17 @@ end
|
|||||||
builtin.find_files = function(opts)
|
builtin.find_files = function(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
|
|
||||||
local fd_string = nil
|
local find_command = nil
|
||||||
if 1 == vim.fn.executable("fd") then
|
if 1 == vim.fn.executable("fd") then
|
||||||
fd_string = "fd"
|
find_command = { 'fd', '--type', 'f' }
|
||||||
elseif 1 == vim.fn.executable("fdfind") then
|
elseif 1 == vim.fn.executable("fdfind") then
|
||||||
fd_string = "fdfind"
|
find_command = { 'fdfind', '--type', 'f' }
|
||||||
|
elseif 1 == vim.fn.executable("rg") then
|
||||||
|
find_command = { 'rg', '--files' }
|
||||||
end
|
end
|
||||||
|
|
||||||
if not fd_string then
|
if not find_command then
|
||||||
print("You need to install fd or submit PR for different default file finder :)")
|
print("You need to install either fd or rg. You can also submit a PR to add support for another file finder :)")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -387,7 +389,7 @@ builtin.find_files = function(opts)
|
|||||||
pickers.new(opts, {
|
pickers.new(opts, {
|
||||||
prompt = 'Find Files',
|
prompt = 'Find Files',
|
||||||
finder = finders.new_oneshot_job(
|
finder = finders.new_oneshot_job(
|
||||||
{fd_string, '--type', 'f'},
|
find_command,
|
||||||
opts
|
opts
|
||||||
),
|
),
|
||||||
previewer = previewers.cat.new(opts),
|
previewer = previewers.cat.new(opts),
|
||||||
|
|||||||
Reference in New Issue
Block a user