nvim-neo-tree / neo-tree.nvim

Neovim plugin to manage the file system and other tree like structures.
MIT License
3.85k stars 224 forks source link

BUG: Filter doesn't work #1459

Open asynchroza opened 6 months ago

asynchroza commented 6 months ago

Did you check docs and existing issues?

Neovim Version (nvim -v)

NVIM v0.9.5

Operating System / Version

MacOS Sonoma 14.4.1

Describe the Bug

Filter doesn't seem to be doing anything. No exception messages are shown, but no results are returned.

Screenshots, Traceback

image

Steps to Reproduce

  1. Pull my config -> https://github.com/asynchroza/nvim-config
  2. Open neo-tree
  3. Try to filter by .lua extension.

Expected Behavior

It should display all files including .lua

Your Configuration

-- references:
-- https://github.com/nvim-neo-tree/neo-tree.nvim
-- https://github.com/nvim-neo-tree/neo-tree.nvim/wiki/Recipes
return {
    "nvim-neo-tree/neo-tree.nvim",
    dependencies = {
        "nvim-lua/plenary.nvim",
        "nvim-tree/nvim-web-devicons",
        "MunifTanjim/nui.nvim",
    },
    event = "VeryLazy",
    keys = {
        { "<leader>e", ":Neotree position=float reveal_force_cwd<CR>", silent = true, desc = "Float File Explorer" },
        { "<leader><tab>", ":Neotree toggle left<CR>", silent = true, desc = "Left File Explorer" },
    },
    config = function()
        require("neo-tree").setup({
            close_if_last_window = true,
            popup_border_style = "single",
            enable_git_status = true,
            enable_modified_markers = true,
            enable_diagnostics = true,
            sort_case_insensitive = true,
            default_component_configs = {
                indent = {
                    with_markers = true,
                    with_expanders = true,
                },
                modified = {
                    symbol = " ",
                    highlight = "NeoTreeModified",
                },
                icon = {
                    folder_closed = "",
                    folder_open = "",
                    folder_empty = "",
                    folder_empty_open = "",
                },
                git_status = {
                    symbols = {
                        -- Change type
                        added = "",
                        deleted = "",
                        modified = "",
                        renamed = "",
                        -- Status type
                        untracked = "",
                        ignored = "",
                        unstaged = "",
                        staged = "",
                        conflict = "",
                    },
                },
            },
            window = {
                position = "float",
                width = 35,
            },
            filesystem = {
                follow_current_file = {
                    enabled = true,
                    leave_dirs_open = false,
                },
                use_libuv_file_watcher = true,
                filtered_items = {
                    hide_dotfiles = false,
                    hide_gitignored = false,
                    hide_by_name = {
                        "node_modules",
                    },
                    never_show = {
                        ".DS_Store",
                        "thumbs.db",
                    },
                },
                buffers = {
                    follow_current_file = true,
                    leave_dirs_open = false,
                },
            },
            event_handlers = {
                {
                    event = "neo_tree_window_after_open",
                    handler = function(args)
                        if args.position == "left" or args.position == "right" then
                            vim.cmd("wincmd =")
                        end
                    end,
                },
                {
                    event = "neo_tree_window_after_close",
                    handler = function(args)
                        if args.position == "left" or args.position == "right" then
                            vim.cmd("wincmd =")
                        end
                    end,
                },
            },
        })
    end,
}
obukhovaa commented 1 month ago

@asynchroza I think I've found the root cause of the issue. A useless -not -path options within find command were excluding all the files if your path contains any . folder, e.g. ~/.config/my-project. Created a fix.

asynchroza commented 1 month ago

Good stuff, @obukhovaa! I just pulled your changes locally and they work. Will surely make life a lot easier.

FourSeventy commented 2 weeks ago

I'm having this same issue