autocmd VimEnter * if filereadable('cctree.out') | CCTreeLoadXRefDBFromDisk cctree.out | endif
我收到错误消息:
E172: Only one file name allowed: CCTreeLoadXRefDBFromDisk cctree.out | endif
答案 0 :(得分:1)
看起来这个命令将|
视为其参数的一部分(除非在定义命令时指定-bar
,否则它是默认值。还有另一个奇怪的默认值)。尝试
function s:TreeLoad(file)
if filereadable(a:file)
execute 'CCTreeLoadXRefDBFromDisk' fnameescape(a:file)
endif
endfunction
augroup VimrcTreeLoad
autocmd!
autocmd VimEnter * :call s:TreeLoad('cctree.out')
augroup END