5

I'm using the :find command as my "fuzzy file searcher" in Vim. My setup:

set path=,,**
nnoremap <leader>f :find *

However, I'm having trouble ignoring folders. Huge folders that contain dependencies, like node_modules, slow down the search a lot and of course pollute the results with things I don't want.

I've tried the following, with no luck:

set wildignore+=node_modules/*
set wildignore+=node_modules/**
set wildignore+=node_modules/**/*

What do I need to do? Thanks

  • How is it possible there isn't a solution for this?? – math2001 Aug 22 '17 at 6:08
5

The following enables fuzzy file search (i.e :find script.js) through every file in your project root while excluding the node_modules dir and its contents.

set path+=**                                                                    
set wildignore+=**/node_modules/** 

Tested on:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 11 2017 13:57:34) MacOS X (unix) version (Compiled by Homebrew)

  • set is missing in the second line. – elquimista Jun 1 '18 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.