On Thursday 12 October 2006 00:43, Peter Hodge wrote: > Ok, the problem is in your .vimrc: > > " this only works if the "filetype plugin indent on" command precedes > the " "syntax on" command > let s:extfname = expand("%:e") > if s:extfname ==? "f90" > let fortran_free_source=1 > unlet! fortran_fixed_source > else > let fortran_fixed_source=1 > unlet! fortran_free_source > endif >
I only followed whatever is given under :help fortran lines 1099 to 1106 of syntax.txt . > If you don't start Vim with a .f90 file, then 'fortran_fixed_source' is set > to '1' and all .f90 files will try to highlight as fixed source (looking > for numbers). You should put the block of code into your > ftplugin/fortran.vim and make it to use the buffer-local variables instead: > > > ~/.vim/ftplugin/fortran.vim > > " Don't do other file type settings for this buffer > let b:did_ftplugin = 1 > > + " use free source format for all .f90 files: > + let s:extfname = expand("%:e") > + if s:extfname ==? "f90" > + let b:fortran_fixed_source = 0 > + else > + let b:fortran_fixed_source = 1 > + endif > Thanks a lot. Your solution works perfectly. One small question. In my previous .vimrc, I had this varible called fortran_free_source. Do I need to worry about it in ~/.vim/ftplugin/fortran.vim or can I just forget about its existence completely? thanks raju