Fortran
  • Learn
  • Compilers
  • Community
  • Packages
  • News
  • Discourse
  • Twitter
  • Github
  • RSS Feed
Back to Learn Fortran index

Setting up your OS

  • Introduction
  • Choosing a compiler
  • Installing GFortran
  • Text Editors
    • IDEs
    • Smart Tips

    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:

    • Atom
    • Emacs
    • NotePad++
    • SublimeText
    • Vim and Neovim
    • Visual Studio Code

    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. The following extensions are suggested for Fortran developement:

    • Modern Fortran by Miguel Carvajal
    • FORTRAN IntelliSense by Chris Hansen
      • Depends on the previous Modern Fortran extension, as well as Python and Fortran Language Server, which need to be installed.
    • Fortran Breakpoint Support by ekibun

    Note: Both Modern Fortran and Fortran Breakpoint Support require ms-vscode.cpptools, for that you will also need to install the C/C++ by Microsoft extension.

    The following are not essential but more advanced users might find useful:

    • Remote - WSL by Microsoft
    • GitLens — Git supercharged by Eric Amodio
    • fprettify by Blamsoft
    • 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:

    • atom-ide ui by facebook-atom
    • language-fortran by dparkins

    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.

    Back

    Next

    Learn · Compilers · Community · Packages · News
    This site's source is hosted on GitHub.