ctrl+n
and ctrl+p
is very convenient completion for Vim, but sometimes it is very slow which may be caused that too many included header file in the current sources. Is there an option to restrict auto completion to search current source file (or opened streams) only?
You have to play around with the complete
option.
From the help file,
The default is ".,w,b,u,t,i", which means to scan:
1. the current buffer
2. buffers in other windows
3. other loaded buffers
4. unloaded buffers
5. tags
6. included files
Personally, I have noted that removing included files was really helpful, so, in my .vimrc, I use:
set complete-=i
But you can remove (or add) other lists as well.
See :help 'complete'
for more information.
If you have a feeling for when this "sometimes" is (a large project, a complex C file with many includes, ...), you can also use the <C-x><C-n>
local file completion, see :help i_CTRL-X_CTRL-N
. This way, you still have the default completion available and don't need to mess with the 'complete'
option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With