2

I'm working on a large scale project with a lot of files, and :find is extremely (several seconds) slow, much slower than :lgrep backed by ag, which skips directories mentioned in .gitignore, e.g. tmp, log, node_modules etc.

At the moment I'm using set path=.,**.

Is there a way exclude specific paths from path?

Any trick with autocmd loading .gitignore and setting path on VimEnter will work.

3

vim-rails and vim-ruby are setting path, and they don't really care that path is limited to 1024 characters on some platforms throwing out what you set.

Solved with autocmd:

let g:project_find_path = '.,' . system("git ls-tree -d HEAD --name-only | tr '\n' : | sed 's/:/**,/g'")
autocmd VimEnter let &path = g:project_find_path
autocmd BufReadPost * let &path = g:project_find_path

Works in fractions of a second now.

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.