Skip to content

Commit c62f82b

Browse files
authored
Merge pull request nvim-tree#1107 from kyazdani42/nvim-tree#1099-search-obey-ignored
nvim-tree#1099 search obeys active ignore filters
2 parents 70508d4 + bf6f3f7 commit c62f82b

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

lua/nvim-tree/actions/search-node.lua

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ local api = vim.api
22
local uv = vim.loop
33
local utils = require "nvim-tree.utils"
44
local core = require "nvim-tree.core"
5+
local filters = require "nvim-tree.explorer.filters"
56
local find_file = require("nvim-tree.actions.find-file").fn
67

78
local M = {}
@@ -27,15 +28,17 @@ local function search(dir, input_path)
2728
break
2829
end
2930

30-
if string.find(path, "/" .. input_path .. "$") then
31-
return path
32-
end
33-
34-
if stat.type == "directory" then
35-
path = search(path, input_path)
36-
if path then
31+
if not filters.should_ignore(path) then
32+
if string.find(path, "/" .. input_path .. "$") then
3733
return path
3834
end
35+
36+
if stat.type == "directory" then
37+
path = search(path, input_path)
38+
if path then
39+
return path
40+
end
41+
end
3942
end
4043

4144
name, _ = uv.fs_scandir_next(handle)

0 commit comments

Comments
 (0)