Question

How can I disable autocomplete in Vim when writing a comment or docstring? I tried au FileType * setl fo-=cro and set fo-=c fo-=o fo-=r but that didn't help. I use Neocomplete.

Was it helpful?

Solution

My OnSyntaxChange plugin may help with this.

First, you need to generate events when entering / leaving comments:

call OnSyntaxChange#Install('Comment', '^Comment$', 0, 'i')

Then, hook commands to enable / disable the auto completion to the events. Fortunately, Neocomplete provides those:

autocmd User SyntaxCommentEnterI silent! NeoCompleteLock
autocmd User SyntaxCommentLeaveI silent! NeoCompleteUnlock

See also this question, which does something similar for the AutoComplPop plugin.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top