5 Jun

Using F# in Sublime Text on Linux Mint

Category:UncategorizedTag: , :

I?ve been learning about functional programming for quite some time now, trying to wrap my head around the various concepts that this paradigm has to offer. One of the languages that spiked my interest besides Clojure is F#.

The reason for this is quite obvious. As a software developer who uses the .NET framework on a daily basis, I regularly run into the limitations of C#. Embracing a powerful functional language that targets the CLR and mitigates most of these limitations definitely looks quite appealing.

My goal has been to limit my use of Visual Studio to the absolute bare minimum. Especially during my spare time where I develop all my hobby projects on Linux Mint. I?m currently dabbling with F# using my preferred editor, Sublime Text.

Setting up F# on Linux Mint is quite easy. You just have to run the following commands:

$ sudo apt-get update
$ sudo apt-get install mono-complete
$ sudo apt-get install fsharp

This couldn?t be more easy. However, using F# in Sublime Text takes a bit more configuration.

First of all, you have to install the F# package which provides F# syntax highlighting for Sublime Text.

Secondly, in order to run F# code from Sublime Text it is recommended that you install the SublimeREPL package. Unfortunately, there is a minor issue with SublimeREPL what makes that the F# REPL doesn?t work in Sublime Text on Linux. In order to fix this issue you can just install SublimeREPL using Package Control and manually apply the changes from this pull request.

After installing these packages, you can add the following custom key bindings to the Key Bindings – User file in Sublime Text.

    "keys": ["ctrl+alt+f"], 
    "command": "run_existing_window_command",
    "args": {
        "id": "repl_f#", 
        "file": "config/F/Main.sublime-menu"
    "keys": ["ctrl+alt+r"], 
    "command": "repl_transfer_current",
    "args": {
        "scope": "selection"

Now when you open a new group in Sublime Text and press the CTRL-ALT-F key combination, you get the following layout:


Selecting the block of F# code in the left pane and pressing the CTRL-ALT-R key combination executes the code in the REPL in the right pane. I personally find this very useful during my explorations of the F# language.

Until next time.

Update 01:

In response to this blog post, Guillermo L?pez mentioned that he has been working on the FSharp package for SublimeText.

@JanVanRyswyck @dsyme This one adds autocompletion to F# in ST: https://t.co/FPICSZxo8W

? Guillermo L?pez (@guillermoooo) June 8, 2015

This package brings autocompletion, live error checking and several other cool things to the table and can easily be installed using package control. Simply a must have when using F# in SublimeText.