There are many editors that support Fortran syntax highlighting.
(TODO expand this list) * Code::Blocks IDE for Fortran An IDE for Fortran 2003 and 2008. * Emacs – V 23.x and later come with f90-mode supporting Fortran 2003. * gedit – free-format Fortran 95 * jed – Programmer’s editor that supports fixed-format Fortran 77 and free-format Fortran 2003 modes with syntax highlighting and smart indentation. * Vim – Supports Fortran syntax up to Fortran 95, but see below. * NEdit – GUI editor with some Fortran support. It used to be a good choice, but is rather obsolete compared to gedit. * Eclipse with Photran – For the IDE users. * Geany: GUI editor with support for many languages as well as Fortran; see below. * Sublime Text 2 – A beautiful text editor (paid but no enforced time limit for free use) that supports Fortran syntax via Textmate bundle. * Kate: – Has syntax highlighting and indentation for Fortran. * Zeus: – A (shareware) programmer’s editor for Windows with Fortran syntax highlighting and code navigation.
An enhanced Vim syntax file that includes Fortran 2003 keywords is available here:
The following can be added to
$HOME/.vimrc. It maps
<shift>-F to toggle between fixed and free format Fortran source. In case it is hit by mistake,
<ctrl>-F is mapped to re-detect the syntax.
nmap <S-F> :set syntax=fortran<CR>:let b:fortran_fixed_source=!b:fortran_fixed_source<CR>:set syntax=text<CR>:set syntax=fortran<CR> nmap <C-F> :filetype detect<CR>
When editing Fortran on Linux I use gedit which is adequate. When editing Fortran on Microsoft Windows (TM) there are lots of editors available, none of them (in my experience) really good enough. Here are my thoughts on a few that I’ve used more than a few times:
Code::Blocks IDE for Fortran (http://darmar.vgtu.lt/): Recommended! Originally developed for C++, this advanced IDE has many features of eclipse and supports most features of Fortran 2003 and 2008. The environment is quite user friendly and easy to use. It is one of the few true IDEs for Fortran. I think the support of the Fortran community will help this IDE to become a very powerful general purpose and fast Fortran programming tool.
Jedit - written in Java - when opening more than one file this has no tabs but a drop-down list at the top, which I find less convenient. But it has good Fortran90 aware syntax highlighting (I had to make a small change to the configuration file to prevent every line starting with C being treated as a comment, but that was not difficult). But the print system is a Java-special, not using the regular Windows print menu, so you can’t alter your printer defaults, e.g. to print 2 pages per sheet of paper. This is an annoyance.
Gedit - there is a windows binary to download which worked with no trouble, but there is no manual and no help (missing file). The syntax highlighting did work for Fortran90, but it did not understand the .f90 or .f95 file extension, and had to be set each time, which was very tedious. I could not find the relevant file on the website, nor when I untarred a regular gedit distribution. Looking at the help on a Linux box there did not seem to be a way of associating file extensions with language highlighting.
Notepad++ - has tabbed browsing, and uses regular Windows printing, but the syntax highlighting was set for Fortran77, and was really not useful. After being annoyed by it for some time, I found it best to disable the highlighting entirely. In principle one could define one’s own Fortran90 syntax file, but I couldn’t be bothered to do this. Apart from this it’s a fairly good editor.
Notetab light - the free version of a commercial editor notetab. This is another adequate editor: regular Windows printing, no tabbed file opening, no syntax highlighting. It seems to have no particular features that at least one of the others has.
Geany(http://www.geany.org/): This is a free open source editor with many capabilities which also supports programming in Fortran. There are several plugins to deal with project management, debugging etc. The editor lets you for extensive customization for a programming language and even adding new one! It is available for both Windows and Linux.
Simply Fortran(http://simplyfortran.com/): lightweight IDE for MS Windows and compatible operating systems. Made with GNU Fortran in mind, but configurable with most compilers, it comes with an intergrated development environment, a graphical debugger, and a collection of other development accessories. In early stages of development as of now, has some bugs, but the author’s working on them.
Programmer’s Notepad - A general source code editor for MS Windows. It can be configured to build Fortran files with arbitrary command lines, or to invoke make in a particular directory. Like many editors, it is C-centric, but the Fortran support is adequate.
Absoft Pro Fortran - A IDE developed by Absoft specially for Fortran. http://www.absoft.com/