I have below autocmd in my cobol.vim
ftplugin file in ~/.vim/ftplugin/
augroup cobmods
autocmd!
autocmd BufNewFile * call s:CleanStart()
augroup END
This doesn't work when I open a file using vim filename.cob.
However, if I put the same in my .vimrc, it works.
Anybody with any insights on how I can change this autocmd to work from cobol.vim
as I really don't want to put cobol related mods in vimrc.
Also looks like, by the time program (vim) flow reaches cobol.vim, BufNewFile
event is no longer valid.
s:CleanStart()
to be doing?BufNewFile *.cobol :call CobolStart()
if !empty(glob(fnameescape(expand('%:p'))))
condition and changed to autocmd toVimEnter *.COB
and now it works as expected. Although I'm not sure if this is the most elegant way.