'ignore named sub directories vim telescope
This question concerns telescope in vim. I can see any info as to the type of regex being used.
With the following setting I can achieve to ignore node_modules only if I start the explorer at the root level where node_modules exist.
telescope.nvim.vim
lua << EOF
require('telescope').setup{
...
file_ignore_patterns = {"node_modules"},
...
}
EOF
How can I achieve the outcome where node_modules is ignored recursively - so ignore any deeply nested node_modules. "node_modules/*" is not working. Unless I can make telescope respect .gitignore would also be a solution.
Thank you in advance for helping.
Solution 1:[1]
From the documentation here, it looks like you can use %
as a wildcard as well as *
. I was able to exclude image files in this way:
file_ignore_patterns = {'%.jpeg'}
I've also been able to get this working:
file_ignore_patterns = {'node_modules/.*'}
If you're still having problems, the git_files
builtin supports .gitignore
out of the box, so use :Telescope git_files
instead of :Telescope find_files
if you're in a git repo.
Finally, you can set the find_command
option in the Telescope setup, so if you're using something like ripgrep
you could tell it to ignore node_modules from there.
Solution 2:[2]
I know this seems late, but the probs in your config is, file_ignore_patterns
should be defined in defaults
objects, like this
require'telescope'.setup({
defaults = {
file_ignore_patterns = { "^./.git/", "^node_modules/", "^vendor/" },
}
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | garwil |
Solution 2 | l3lackheart |