How to ignore some files for a Vim word?

Let's say I am working on parsing very large data files (each file is roughly a few megabytes). I want to write syntax code to view these data files, so I have multiple windows in Vim, some are code files and some are data files.

In this case, Vim's word completion in insert mode is very slow because it tries to scan the data file. To avoid this situation, I want to ignore those data files that have a non-programmatic extension (e.g. dat, txt instead of c, rb, py), but keep watching the program files. So the best thing is that I can register some extensions to be ignored during word completion.

How can I achieve this? I looked at h: 'complete' but I couldn't find what I want. For example, set complete-=w

the .vimrc doesn't satisfy me because it ignores not only data files but program files as well, which completely messes up word completion.

Thank you for your help.

+3


source to share


1 answer


You have two options: work with / reconfigure completion sources in options, 'complete'

or write your own completion yourself.

For the latter, my CompleteHelper library provides helper functions that make this pretty easy. For example, the SameFiletypeComplete plugin (which is based on this library) only considers buffers with the same file type. Of course, any custom execution is not as fast as the built-in one, and my library is currently limited to buffer lookups (no tags, dictionaries, etc.).



I would personally make those big data files not listed via :setlocal nobuflisted

and open them in a separate tab; the default for 'complete'

will ignore those (since it contains no value U

).

+3


source







All Articles