On Wednesday, September 26, 2012 7:34:17 AM UTC-7, Ben Fritz wrote:
> On Tuesday, September 25, 2012 7:12:41 PM UTC-5, Paul Lou wrote:
> 
> > Hello all,
> 
> > 
> 
> > First I'd like to thank the VIM team for creating one of the best and most 
> > flexible editors in the world.
> 
> > 
> 
> > I just started learning VIM with Fortran, and I realized a syntax coloring 
> > problem when creating a Fortran file through
> 
> > 
> 
> > vim example.f
> 
> > 
> 
> > As shown in shot.png, the syntax coloring is only working partially.
> 
> > 
> 
> > However, if I reopen the file, the syntax coloring will be fully working, 
> > as shown in shot2.png.
> 
> 
> 
> As you guessed, it looks like somehow the wrong filetype/syntax is being 
> loaded. What is the output of the following, before and after reopening?
> 
> 
> 
>   :verbose set filetype?
> 
> 
> 
> What command did you use to open the file? What command did you use to 
> "reopen" the file?
> 
> 
> 
> > 
> 
> > I tried to add
> 
> > 
> 
> > au BufNewFile,BufReadPost *.f,*.for,*.fpp,*f95,*f90 setf fortran
> 
> > 
> 
> > into .vimrc but it doesn't seem to work.
> 
> 
> 
> :setfiletype is designed to NOT take any action if the filetype has already 
> been set in a chain of autocmd events. As a workaround, try "setl 
> filetype=fortran" instead of "setf fortran". But this is a workaround. You 
> should figure out why Vim is detecting the wrong filetype, if this is 
> actually the problem.
> 
> 
> 
> > 
> 
> > I am currently running Debian Wheezy, VIM 7.3.
> 
> > 
> 
> > Is it because Vim shipped in Wheezy is not up to date?
> 
> > 
> 
> 
> 
> I don't know. What version of Vim ships with Wheezy? Paste the first few 
> lines of output from the :version command in Vim, up to the 
> "Huge/Big/Normal/Tiny version with/without GUI" line. But any version of 7.3 
> ought to work fine for what you're trying to do, so I doubt very much it's a 
> version problem.

Hello Ben,

Thanks for the reply.

Odd enough, when I "create" a file by the command

$ vim test.f

":verbose set filetype" gives

 filetype=fortran
        Last set from /usr/share/vim/vim73/filetype.vim

But the colorings are off just like snap1.png

The ":verbose" output is also the same if I "reopen" an already existing 
fortran file by "$ vim existed.f" but the colorings will be correct instead.

So I'd assume Vim chooses the right file type.

Here is the output from :version,

|VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Sep 16 2012 04:12:21)
|Included patches: 1-547
|Modified by [email protected]
|Compiled by [email protected]

Since Vim does detect the correct file type, then what might be causing Vim to 
incorrectly render some of the codes (Such as "print *" is rendered correctly 
but not "program")? I'd assume Vim syntax files do not apply different 
colorings for newly created files and opening existing files right?

Thank you,
Paul.

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to