In commands [1] below, it works if filetype is not 'c' or' cpp,
shows errors if &ft is 'c' or 'cpp'. What am I doing wrong in [1] ?
Does parser somehow get confused before of after the 'else' ?

Exact steps to reproduce:
- put commands [1] into file /tmp/sect.vim
- vim -u NONE
:so /tmp/sect.vim
:e /tmp/x.cpp
:set ft=cpp
:SECT

Thanks
Yakov

[1] " file sect.vim
:command! SECT :call SectionHeader()
function! SectionHeader()
   if &ft == 'cpp' || &ft == 'c'
a
// *****************************************************
//
// *****************************************************
.
   else
a
# *****************************************************
#
# *****************************************************
.
   endif
endfunction

[2]
Error detected while processing function SectionHeader:
line    9:
E488: Trailing characters: #
*****************************************************
line   11:
E488: Trailing characters: #
*****************************************************

Reply via email to