Vim highlighting weird parts of FORTRAN

rusty picture rusty · Jun 10, 2014 · Viewed 11.2k times · Source

I am using VIM theme molokai, if that makes any difference.

I have been learning FORTRAN lately and when I write a FORTRAN program using VIM, I have weird coloring depending on my whitespace.

For instance, if I tab things over as is (no indenting) I have this purple highlight on only a portion of the word (sometimes it isn't there, notice the PRINTs and READs).

without tabs

If I tab it over it looks normal:

with tabs

I am new to VIM (not to mention FORTRAN) so I am not sure what's happening, I don't mind tabbing over all the time but I think it looks a little ridiculous if the whole program is wasting that column of white space.

Answer

dwwork picture dwwork · Jun 11, 2014

If you search :help fortran, you'll get a list of options that you can set. These are the fortran options I set in my own .vimrc file. (I don't work with fixed-format code though) I know there are one or two fortran specific scripts that are available online, but I don't use them.

let fortran_free_source=1
let fortran_have_tabs=1
let fortran_more_precise=1
let fortran_do_enddo=1