-
Notifications
You must be signed in to change notification settings - Fork 255
Feature Request: Excluded path for filter_on_submit
, filter_as_you_type
#86
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
Comments
It's a good idea, the question is how exactly to do this. I like the idea of excluding glob patterns, but there can be a lot of variation of what each system's built in fd/find/where command will support. Since I am only testing on my own system, I would prefer to just give people the ability to add their own arbitrary arguments to be injected into the find command we ultimately execute. That would offer the ultimate flexibility for the end user without me having to worry about supporting systems I don't have. Because I love having everything be dynamic, I would make this option take either a string or a function. The function would be told what the root path is and what the search term is and be able to dynamically pass back extra arguments. You might want to use this to have different excludes for different root directories. What do you think? |
I was thinking about the same! Currently, you provide a string -- ['/'] = 'open_vsplit' -- current one
['/'] = function (tools) -- Or we don't need this param, just use `require('neo-tree')`
tools.open_vsplit()
-- require('neo-tree').open_vsplit() -- or this way without `tools`
-- User can do other thing
end But it's hard to imagine for some cases like
This one will provide an awesome experience! |
Recreating the entire command in this case would be a lot of work because it's definitely the most complicated one. I was thinking of adding this as a simplier configuration option, alongside other filter options: require("neo-tree").setup({
filesystem = {
search_limit = 50,
find_cmd = "fd",
find_args = "--exclude SomeDir/*" -- I have no idea what the real syntax is yet
-- or use a function instead of string
find_args = function(path, search_term)
if string.len(search_term) > 3 then
return ""
end
if path == "/home/cseickel" then
return "--exclude Library/*"
else
return "--exclude node_modules/*
end if
end
}
}) |
@cseickel: I like this one. I'm using another plugin which has a similar design and it works very well. Here is my config for reference to the structure: use {
-- WARNING: fzf-lua does not include fzf. Run `brew install fzf --HEAD` first!
'ibhagwan/fzf-lua',
requires = {
'kyazdani42/nvim-web-devicons'
},
config = function()
local actions = require "fzf-lua.actions"
require'fzf-lua'.setup {
-- many lines skipped
files = {
show_cwd_header=true,
prompt = ' File $ ',
-- WARNING: Run `brew install fd` to install fd.
fd_opts =
"--hidden "..
"--no-ignore "..
"--ignore-case "..
"--type f "..
-- "--max-depth 15 "..
" "..
"--exclude .local "..
"--exclude .npm "..
"--exclude .nvm "..
"--exclude .tmux "..
"--exclude .cache "..
"--exclude .vscode "..
" "..
"--exclude .DS_Store "..
"--exclude .git "..
"--exclude node_modules "..
"--exclude package-lock.json "..
"--exclude yarn.lock "..
"--exclude tags "..
" ",
actions = {
-- WARNING: Required to prevent qf-list on multi-selection.
["default"] = actions.file_edit,
}
}, |
@cseickel: Is it possible to use the plain-old built-in |
You are supposed to be able to map "/" to "none" to go back to the built-in vim search. I'm not sure if that will work based on your other bug, but it definitely will after I fix it. |
This is in main right now, find_args = {
"--exclude", ".git",
"--exclude", "node_modules"
}, OR -- or use a function instead of list of strings
find_args = function(cmd, path, search_term, args)
if cmd ~= "fd" then
return args
end
--maybe you want to force the filter to always include hidden files:
table.insert(args, "--hidden")
-- but no one ever wants to see .git files
table.insert(args, "--exclude")
table.insert(args, ".git")
-- or node_modules
table.insert(args, "--exclude")
table.insert(args, "node_modules")
--here is where it pays to use the function, you can exclude more for
--short search terms, or vary based on the directory
if string.len(search_term) < 4 and path == "/home/cseickel" then
table.insert(args, "--exclude")
table.insert(args, "Library")
end
return args
end, |
A good reason for me to switch to update: Confirmed it works on:
|
I put the wrong number in the commit. For reference, this was closed in Release v1.23 in commit 751ee6b. |
As title. This is a must-have I promise. The current situation is that in both cases some stupid folder like
~/Library/
will be scanned and cause the entire tree to get frozen & my computer very hot!Debug info.
NVIM Version
The text was updated successfully, but these errors were encountered: