Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Telescope ignore files inside node_modules?

I'm new in the VIM / NEOVIM world so I probably am doing something else wrong, but from the docs it says that Telescope will ignore all the files registered in the .gitignore file, which is definitively there but it still searches in node_modules

So this is what I do:

  1. I cd into my project folder
  2. Hit nvim
  3. hit <leader>ff
  4. Telescope opens and I start typing, but searches are really slow because they are including node_modules

These are the plugins that I have for setting up telescope

" Telescope
Plug 'nvim:solua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'

And then my remaps right from the docs:

" Find files using Telescope command-line sugar.
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>

All this is running in a WSL terminal with Ubuntu. What am I missing?

like image 367
Daniel Rodríguez Meza Avatar asked Jan 31 '26 21:01

Daniel Rodríguez Meza


1 Answers

Just add

require('telescope').setup{ 
  defaults = { 
    file_ignore_patterns = { 
      "node_modules" 
    }
  }
}

to your init.lua

like image 142
Anoop D Avatar answered Feb 02 '26 20:02

Anoop D



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!