Text Editors#

After you have installed your compiler, you will need a text editor to write your code. Any text editor can serve this purpose, even the built-in Notepad on Windows. However, there are specialized editors for programming languages. These editors come with many useful features like auto-complete, syntax-highlighting, auto-indentation, brace-matching, and many more, with few of them pre-installed and the majority in form of external plug-ins. This means that by default these features are not installed in the editor, but it's up to you to search for them through a package manager and install and configure them manually.

Here's a list of the most popular text editors that support Fortran syntax, in alphabetical order:

A comprehensive list with more choices is provided in fortranwiki.org.

Things to consider before choosing a text editor:

  • Ergonomics: This is purely subjective and concerns how easy, uninterrupted the UI (User Interface) feels to the developer while using the editor.

  • Extensibility: As mentioned above, text editors come with many features as external packages. The variety, the installation process, the documentation, and user-friendliness of the packages all fall under this category.

  • Speed: With how powerful modern hardware can be, the speed of editors is becoming of minor importance. However, for the less powerful systems, you may want to consider this as well. Heavyweight editors may impact the writing performance. For example, you can expect Atom and VSCode to run slower than the lightweight editors like Vim or Emacs.

  • Learning curve: Last but not least, new users should consider how easy it is to get used to a new editor. Vim and Emacs have a steep learning curve and are notoriously difficult for newcomers. They offer a uniquely different experience than any other editor by forcing you to use the keyboard for all editing tasks.

Configuring VS Code#

With the editor opened, at the main UI, at the buttoned-column on the left, there is a four-square-shaped icon to open the Marketplace for extensions. Install Modern Fortran for syntax highlighting, linting and Language Server support and formatting.

Additional Tools#

The following extensions are not essential but most users might find them useful:

  • GitLens for advanced Git visualization and operations.

  • CMake for full-featured CMake integration in VS Code.

  • Remote Development for working with containers, on a remote machines, or in the Windows Subsystem for Linux (WSL).

  • Even Better TOML by tamasfe. For Fortran developers that are using the new fpm Fortran Package Manager, a TOML language support might come in handy.

Configuring SublimeText#

A well structured gist that provides instructions on how to set up SublimeText for Fortran developement is given here.

Configuring Atom#

Atom's configuration process is similar to VSCode one. At the main interface, if the Welcome Guide page is already opened for you, just click the Install a Package option, otherwise you can find the same option through the navigation bar at the top by clicking Packages. In doing so a new page under Settings opens where you can just start typing the package you want to install.

One package that includes many Fortran features is IDE-FORTRAN by hansec. It needs the following packages to be installed:

Additionally just like in VSCode it needs Python and Fortran Language Server to be installed.

For version control a very popular package is Git-Plus by akonwi.