neocomplete自动填充功能无法正常使用语法文件

时间:2016-10-23 12:31:48

标签: angularjs vim vim-syntax-highlighting omnicomplete neocomplete

此部分位于我的.vimrc:

" Enable omni completion
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags

编辑.html文件时,我点击了<,并按预期弹出了新的CompleteTags建议列表。

之后,当输入< div ng-时(如在angularjs指令中[没有空格])没有任何东西弹出,尽管安装了angularjs的语法文件(通过javascript-libraries-syntax.vim插件)

然而,在执行该行时 set ofu=syntaxcomplete#Complete或类似set omnifunc=syntaxcomplete#Complete一切正常,我看到了指令列表。

  1. 不应该使用开箱即用的语法关键字吗?
  2. 我可以使用多个omnifunc来解决此问题吗? #CompleteTags和#Complete都是?

1 个答案:

答案 0 :(得分:0)

  
      
  1. 不应该使用开箱即用的语法关键字吗?
  2.   

确实(来自neocomplete文档,neocomplete-syntax部分):

 If you want to complete the candidates from syntax files, you need to
 install the neco-syntax plugin (https://github.com/Shougo/neco-syntax).
  
      
  1. 我可以使用多个omnifunc来解决此问题吗? #CompleteTags和#Complete?
  2.   

当然你可以(再次来自neocomplete文档,g:neocomplete#sources#omni#functions部分):

g:neocomplete#sources#omni#functions
        This dictionary which appoints omni source call functions.
        The key is 'filetype'.  The value is omnifunc name String or
        List of omnifunc name String.
        If |g:neocomplete#sources#omni#functions| [&filetype] is
        undefined, omni source calls 'omnifunc'.
        If the key is "_", used for all filetypes.

        Default value is {}.

请将以下词典添加到.vimrc

let g:neocomplete#sources#omni#functions = {
  \ 'html': ['htmlcomplete#CompleteTags', 'syntaxcomplete#Complete']
  \ }

第一种或第二种方法都应解决问题。

相关问题