Vim omnifunc没有调用filetype

时间:2015-06-29 21:39:59

标签: vim

我无法根据omnifunc将功能分配给filetype

我有一个名为supercollidercomplete.vim的文件,其中supecollider是我定位在autoload上的runtimepath文件夹中的文件类型。

它包含此功能(基于omnifunc帮助文件示例):

fun! supercollidercomplete#CompleteMonths(findstart, base)
  if a:findstart
" locate the start of the word
let line = getline('.')
let start = col('.') - 1
while start > 0 && line[start - 1] =~ '\a'
  let start -= 1
endwhile
return start
  else
" find months matching with "a:base"
let res = []
for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")
  if m =~ '^' . a:base
  call add(res, m)
  endif
endfor
return res
  endif
endfun

但是当我转到supercollider文件时,当我尝试omnifunc并且执行C-x C-o时确实没有分配任何内容时,set omnifunc?未被调用。

我错过了什么吗?

1 个答案:

答案 0 :(得分:0)

好吧我明白了。似乎我需要将它添加到我的vimrc:

au FileType supercollider set omnifunc=supercollidercomplete#CompleteMonths

现在它正好接受它。

相关问题