1

I am using Vim 8.2 on Windows 10. Autocompletion (using CTRL+N or CTRL+P) upon creating the tags file using ctags.exe works fine for me.

Now I want to use the find command in vim to quickly opening any file in the project directory. Therefore I set set path=.,**,, in my vimrc file; now executing :find foo.py opens immediately that file, which is deep inside the project. However, trying to autocomplete freezes the editor (the status line shows Scanning tags.)

Is there a solution to this problem or are autocompletion and (accelerated) find mutually exclusive?

4
  • :find wasn't meant to be a fuzzy-finder. 'path' co-operates with gf and friends, as well as include and define searches. :find and :sfind are basically gf as a command with arguments. OTOH, regular <C-n>/<C-p> will look at included files as well as tags (and other things: see :help 'complete'), so it's possible that so many files are included it takes a long time to process. Maybe edit in :checkpath! as well as :setlocal complete? include? includeexpr? tags?
    – D. Ben Knoble
    Commented Sep 22, 2021 at 18:37
  • Thank you @D.BenKnoble for this information.
    – Jorge D
    Commented Sep 28, 2021 at 9:25
  • Thank you @D.BenKnoble for this information. To summarize: configuring the path variable is a way to accelerate commands like gf rather than (or instead of) optimizing the :find command. It has however a drawback: if defined too broadly, it slows down the ctags-based autocompletion like C-n or C-p. If you wish to reword this as an answer, I would approve it - just to close the loop for other readers.
    – Jorge D
    Commented Sep 28, 2021 at 9:31
  • Feel free to self-answer. As I said I’d be surprised about that level of impact unless there were also lots of included files (where I am referring to include-search).
    – D. Ben Knoble
    Commented Sep 28, 2021 at 11:12

1 Answer 1

1

Summarizing feedback by @D.BenKnoble: yes, setting path so that lots of directories/files are included does have an impact on the speed of completion commands like C-n and C-p, because the all those files are considered when searching for a completion.

A trade-off could be e.g. not to include the whole project but only those directories which matter to you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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