vimfile-typeautocmd

autocmd does not detect *.ott files


I'd like to have syntax highlighting on files with the .ott extension (using ott-vim), but I am not getting any colors when opening a file, even though filetype=ott is set. Re-setting set filetype=ott manually does enable the colors again.

Oddly enough, I also get colors on file opening when I change the extension in ftdetect/ott.vim to something other than *.ott.

Is there something special about the *.ott extension, or some clash with another file format?

au BufRead,BufNewFile *.ott set filetype=ott
" a.ott does not get highlighted
" Replace *.ott with *.ot, then a.ot gets highlighted

Solution

  • This is a conflict with the zipPlugin that is distributed with vim (/usr/share/vim/current/plugin/zipPlugin.vim), and which recognizes a .ott file as a zip archive. Hacky fix to remove that extension from those recognized by zipPlugin:

    " ~/.vimrc
    let g:zipPlugin_ext='*.zip'