Timur B
Timur B

Reputation: 323

How to get proper text-color-highlighting for Fortran 90 in Sublime Text 2?

There are a couple of links on sublime forum, on how to get Sublime Text 2 to work with Fortran 90 here http://www.sublimetext.com/forum/viewtopic.php?f=4&t=770, but they don't quite seem to work as the comment identifier "!" is not treated well.

I quickly assembled a solution using the original suggested Punchcard.tmLanguage file and modifying the first block in dictionary to treat "!" as comment (available here: https://gist.github.com/4209445).

Sublime Text 2 is a great text editor and having it support Fortran might be helpful for many people in Theoretical physics and Finance. So if anyone knows a better solution, please let me know.

Thanks!

Upvotes: 27

Views: 20435

Answers (3)

shridharama
shridharama

Reputation: 979

Also check out Minimal Fortran. Been using it for a couple of months and can vouch for it. Easy to install using Package Control as well.

Upvotes: 1

Filipe
Filipe

Reputation: 659

I also use Fortran (Modern) with Sublime Text (now I'm using version 3) and there was just a little glitch handling comments. Look at this example:

As you can see, the second line starts with an exclamation mark, but it's not recognized. But if I start the first line with "! " (including a space), then everything works:

If I put a dash after the ! of the second line, it reconizes it as a comment, but the problem goes to the third line:

I don't understand the language of the syntax file, but I've looked at the MinimalFortran package to fix this (this package works great and can be installed using Package Control, but it misses lots of syntaxes). I just changed the

<string>!-</string>

to

<string>[!]</string>

on the "Fortran - Modern.tmLanguage" file and it all worked:

Upvotes: 7

bananafish
bananafish

Reputation: 2917

The plugin at the fortran.tmBundle works for me. I created a Fortran subfolder in Packages and put all the files in the tmBundle there (not just the .tmLanguage files). It selects Fortran - Punchcard as the default type for .for and Fortran - Modern for .f90 files. These both treat ! just fine on my system - what problem are you having?

Upvotes: 25

Related Questions