Its seems that CCTreeLoadDB
think that the |
and endif
are parameters to it commands instead of the separator to the if
.
Wrapping it in a function so that the if
statement is on multiple line makes the autocmd
work.
function! LoadCCTree()
if filereadable('cscope.out')
CCTreeLoadDB cscope.out
endif
endfunc
autocmd VimEnter * call LoadCCTree()
Working one liner that doesn't use a function wrapper. Wrap the CCTreeLoadDB
in an exec so it doesn't get confused.
autocmd VimEnter * if filereadable('cscope.out') | exec "CCTreeLoadDB 'cscope.out'" | endif
See Ingo Karkat's answer for why CCTreeLoadDB
does not work with |