Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: search user config when cwd is nvim config path. #1388

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions lua/modules/configs/tool/search.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
return function()
local builtin = require("telescope.builtin")
local extensions = require("telescope").extensions
local vim_path = require("core.global").vim_path

require("modules.utils").load_plugin("search", {
collections = {
Expand All @@ -12,7 +13,9 @@ return function()
name = "Files",
tele_func = function(opts)
opts = opts or {}
if vim.fn.isdirectory(".git") == 1 then
if vim.fn.getcwd() == vim_path then
builtin.find_files(vim.tbl_deep_extend("force", opts, { no_ignore = true }))
elseif vim.fn.isdirectory(".git") == 1 then
builtin.git_files(opts)
else
builtin.find_files(opts)
Expand Down Expand Up @@ -46,13 +49,20 @@ return function()
{
name = "Word in project",
tele_func = function()
extensions.live_grep_args.live_grep_args()
local opts = {}
if vim.fn.getcwd() == vim_path then
opts["additional_args"] = { "--no-ignore" }
end
extensions.live_grep_args.live_grep_args(opts)
end,
},
{
name = "Word under cursor",
tele_func = function(opts)
opts = opts or {}
if vim.fn.getcwd() == vim_path then
opts["additional_args"] = { "--no-ignore" }
end
builtin.grep_string(opts)
end,
},
Expand Down
Loading