Thursday, August 27, 2009

Re: Problem with IDL file detection

Yes, I can reproduce it now. The problem lies in vim's file type
detection script $VIMRUNTIME/filetype.vim, which has the following:

" Distinguish between "default" and Cproto prototype file. */
func! s:ProtoCheck(default)
" Cproto files have a comment in the first line and a function
prototype in
" the second line, it always ends in ";". Indent files may also
have
" comments, thus we can't match comments to see the difference.
if getline(2) =~ ';$'
setf cpp
else
exe 'setf ' . a:default
endif
endfun

So if the second line ends in a semicolon, it's assumed that the file
is a "Cproto" file.

Vim has a few mechanisms to cope with this file type trouble. One
would be create the following as ~/.vim/filetype.vim (or ~/vimfiles/
filetype.vim on Windows):

" override .pro file type detection
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
au! BufRead,BufNewFile *.pro setfiletype idlang
augroup END

See :help filetype for the messy details.

Regards, John
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments:

Post a Comment