我无法根据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?
未被调用。
我错过了什么吗?
答案 0 :(得分:0)
au FileType supercollider set omnifunc=supercollidercomplete#CompleteMonths
现在它正好接受它。