Andre Luis IM
Andre Luis IM

Reputation: 49

Vim :find command deadlock

When I use the :find command followed by the first letters of a file name and then hit tab (to get autocompletion), VIM locks, and I have to shut down and start over.

For instance, I write

:find nam

and then I hit tab. VIM write three dots after:

:find nam...

and then stops working. Indefinitely. This happens when I am on the root directory of a project I'm working on. This directory has the following sub-folders:

.git/
.idea/
.sass-cache/
.tmp/
app/
node_modules/
phone/
test/

And these files:

.bowerrc
.gitattributes
.gitignore
.jshintrc
Gruntfile.js
Readme.md
bower.json
karma.conf.js
npm-debug.log
package.json
todo.txt

If I cd to the app directory and try the same command, when I hit tab the autocompletion works perfectly.

I'm running VIM on Windows. I have set the path variable to .,,** on my _vimrc file (set path=.,,**).

Well, does anyone have any idea about what is happening? Thanks.

Upvotes: 2

Views: 143

Answers (1)

romainl
romainl

Reputation: 196751

AFAIK, :find uses a wasteful depth-first strategy that makes it dig into every directory and every sub-directory before going to the next directory at the same level.

Earlier versions of npm were notorious for the potential depth of the node_module directory structure so it's very likely that your node_modules directory acts as a trap, here.

Since you probably don't want to edit anything in node_modules I suggest you add it to your wildignore option:

set wildignore+=*/node_modules/*

Also, ** in set path=.,,** implies ,, so you could simplify that value to .,**.

Upvotes: 2

Related Questions