I make use of vim's <C-n>/<C-p> auto-completion menu with the default complete setting .,w,b,u,t,i.

This generally works great, but I'd like to have Vim ignore buffers from a certain directory, even though they are loaded. For example, a directory containing large log files does not need to be scanned for completion (and it slows down Vim to do so).

How can I achieve this?

  • There is no option for that so no, not without writing your own alternative completion function.
    – romainl
    Sep 9, 2023 at 19:46
  • I skimmed the documentation for the alternative completion function. It mentions allowing setting a function for finding the start of the text to be completed, and a function to actually find the matches, but I don't see mention of specifying the files to be searched through. Do you think it's possible to implement it with the completefunc? Sep 9, 2023 at 19:56
  • 1
    Searching through buffers and files, and skipping some of them, would be the responsibility of the second function.
    – romainl
    Sep 10, 2023 at 6:39
  • Thank you! Let me take a closer look. Sep 10, 2023 at 7:36


Your Answer

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

Browse other questions tagged or ask your own question.