Add search text inside folder #1167
thuan1412
started this conversation in
Show and tell
Replies: 2 comments 1 reply
-
i think this could be very easily done in your config. You should just add a custom mapping, the node is passed as a parameter so you can send its path into the telescope command and then calling nvim tree find file. This should do the behavior you want. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Here is my config to add this action. local function getDirFromPath(path)
if path:match("/") then
return path:match("(.*)/")
else
return path:match("(.*)\\")
end
end
local function findInFolder(node)
local absolute_path = node.absolute_path
local dir = getDirFromPath(absolute_path)
require("telescope.builtin").live_grep({ cwd = dir })
end
....
mappings = {
custom_only = true,
list = {
{ key = "f", action = "find in folder", action_cb = findInFolder },
},
},
.... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have an idea about a new action for
nvim-tree
. That is search/find text in a folder. To accomplish this action, we may call a command from other plugins likeTelescope live_grep cwd={dir}}
.This action will be very useful when we work in a large project, where we just want to find the text from a single folder, not the whole project. Currently, I have to type a command to do this.
If you think this
action
is out of the scope of this plugin, maybe you consider supporting custom action, so that we can easily add a new action when working with nvim-tree.Beta Was this translation helpful? Give feedback.
All reactions