Skip to content

Instantly share code, notes, and snippets.

@skellertor
Last active October 7, 2019 12:12
Show Gist options
  • Save skellertor/1a450becfd9f86858f2c to your computer and use it in GitHub Desktop.
Save skellertor/1a450becfd9f86858f2c to your computer and use it in GitHub Desktop.
Install SublimeREPL for SML

πŸ’» πŸ’» πŸ’» πŸ’» πŸ’» πŸ’» πŸ’» πŸ’» πŸ’» πŸ’» πŸ’» SublimeREPL for SML πŸ’» πŸ’» πŸ’» πŸ’» πŸ’» πŸ’» πŸ’» πŸ’» πŸ’» πŸ’» πŸ’»

This tutorial assumes you already have Sublime text editor with Package Control installed as well as smlnj installed. Complete the installations with the links provided before continuing if you haven't already done so. πŸ‘Œ

  • Open Sublime and go to Preferences > Browse packages

  • Browse to the folder User inside the packages folder

  • Create a folder called SML

  • Inside the newly created SML folder, create two files πŸ“„

    • Default.sublime-commands
    • Main.sublime-menu
  • Past the following code into the file Default.sublime-commands and save it:

[
    {
        "caption": "SublimeREPL: SML",
        "command": "run_existing_window_command", "args":
        {
            "id": "repl_sml",
            "file": "config/SML/Main.sublime-menu"
        }
    }
]
  • Paste the following code into Main.sublime-menu and save it:
[
     {
        "id": "tools",
        "children":
        [{
            "caption": "SublimeREPL",
            "mnemonic": "r",
            "id": "SublimeREPL",
            "children":
            [
                {"command": "repl_open",
                "id": "repl_sml",
                 "caption": "SML",
                 "args": {
                    "type": "subprocess",
                    "encoding": "utf8",
                    "cmd": ["/usr/local/smlnj/bin/sml"],
                    "cwd": "$file_path",
                    "syntax": "Packages/SML (Standard ML)/sml.tmLanguage",
                    "external_id": "sml",
                    "extend_env": {"NODE_DISABLE_COLORS": "1"}
                    }
                }
            ]
        }]
    }
]
  • The nested cmd property should be changed to the location of your smlnj executable
  • Restart Sublime text editor
  • Go to Tools > SublimeREPL > SML
  • You should now be able to create .sml files within Sublimes' text editor and then run them quickly within Sublimes' sml repl πŸ‘πŸ‘πŸ‘πŸ‘

πŸ“ [Original Source click here] (https://developerinmotion.wordpress.com/2013/02/07/sublime-text-2-and-sml)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment