[EMAIL PROTECTED] wrote:
Hi!
(I have vim 6.3.86 on a Linux machine.)
I have to edit some FORTRAN 77 files, which have a naming scheme like:
cmedt.edt.SOMENAME.f_#
where # is a number. I cannot change anything on this naming scheme. So,
I put an autocommand in my .vimrc:
au BufNewFile,BufRead,BufNew cmedt.edt.*.f_* set filetype=fortran
It works almost fine, but I have two problems:
1) The fortran dialekt is setted to f95. I could set this by an
autocommand as well:
au BufNewFile,BufRead,BufNew cmedt.edt.*.f_* let fortran_dialect="f77"
But would this be the correct way? And should this be done before or
after the autocommand from above?
Almost. I suggest
augroup filetypedetect
" possibly other filetype-detection autocommands here
au BufRead,BufNewFile cmedt.edt.*.f_*
\ let fortran_dialect = "f77" |
\ setf fortran
" possibly other filetype-detection autocommands here
augroup END
not in .vimrc but in ~/.vim/filetype.vim (for one user only) or
$VIM/vimfiles/filetype.vim (for all users on this system). The
start-of-line backslash indicates a continuation line, and the bar is
required between statements on a single "line".
Create the directory and/or the file if they don't exist yet.
2) Maybe this "problem" is correlated with 1) and its the thing which
annoys me much! In the files I like to edit, comments start with a
"C", but also with a "*". But one cannot see it in the syntax
highlightning. It looks like normal code. A comment starting with a
"!" would look OK. But it is not an option to change all comments to
comments starting with "!". So, what do I have to do, to get a
correct comment handling?
Best,
Dirk
If you set the correct syntax dialect, comments should be highlighted
correctly, usually in blue. I learnt Fortran in 1967 and comments had to
start with a C and nothing else. The * was a later (but not much)
development.
Best ergards,
Tony.