سؤال

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.

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top