Search code examples
sublimetextsublime-text-pluginsublimerepl

how to write package for sublimeREPL


The SublimeREPL plugin for ST supports lots of languages, but not all of them. It also supports writing your own configuration file for any non-default languages. Once you've written this configuration, is there any way to include it in a regular Sublime Text plugin so that when installed along with SublimeREPL it will work and support the desired language?


Solution

  • This turned out not to be so bad. What I wanted was to be able to distribute files in a package that would work with SublimeREPL without the user moving the files. All of the tutorials I found involved having the user place command and menu files in the SublimeREPL package directory.

    Sublime Text doesn't care where it finds configuration files; they're all loaded no matter where in the packages directory they are found. Main.sublime-menu adds to the main menu and *.sublime-commands add commands.

    First, fill in and rename Main.sublime-menu.template. Then do a Default.sublime-commands as well (couldn't find a template):

    [
        {
            "caption": "SublimeREPL: XYZ Console",
            "command": "run_existing_window_command", "args":
            {
                "id": "repl_xyz",
                "file": "../XYZ-package/Main.sublime-menu"
            }
        }
    ]
    

    The thing that was confusing me was how to refer to the menu file from the commands file, but it's simple; SublimeREPL uses the SublimeREPL as the working directory, so simply make a path from there to the menu file in your own package: ../XYZ-package/Main.sublime-menu.

    Add these completed files to your package and they will work just fine with SublimeREPL.