Vim's autocomplete is excruciatingly slow

后端 未结 3 949
难免孤独
难免孤独 2021-01-29 22:08

Most of the time the autocomplete feature in Vim works nicely for me, but sometimes it seems to be scanning files which the current file references, and then it becomes painfull

3条回答
  •  醉梦人生
    2021-01-29 22:50

    As I mentioned in a comment I had the same problem. Here's what I found;

    There's a setting telling VIM where to look for completions, called complete.

    :set complete
    complete=.,w,b,u,t,i
    

    this is the default value. My problem is (was actually..) the 'i', which scans all included files. Here are two problems, first one, finding all those files might take quite a while, especially if you, like me, have

    :set path=**
    

    Second problem, once found, they need to be read, and if you're using a networked file system (I'm on clearcase) both finding and reading all those files might trigger cache misses, making it painfully slow.

    I've removed the i for now, as I have a tags-file and more often than not, I also have the relevant files in my buffers (loaded or unloaded) which will be searched as a result of 'b' and 'u'.

    Use

    set complete-=i
    

    to remove the i from the list, note that this is local to the buffer.

提交回复
热议问题