Sublime Text, SublimeREPL, Clojure & Windows 8
Asked Answered
C

2

7

I've got both Leiningen & Clojure working on Windows 8 separately from Sublime Text (e.g. I can get a repl working in Windows PowerShell).

My problem is that I can't get the SublimeREPL working in SublimeText (the REPL loads up but doesn't then do anything). Are there any simple traps that I might be missing or, failing that, are there a series of steps I could follow to troubleshoot?

Congeneric answered 20/1, 2014 at 22:49 Comment(0)
M
7

Please see this SublimeREPL issue for instructions on how I got a Clojure REPL to work, at least on XP (I haven't tried it on Win7 or 8 yet). Basically, I edited the menu file for Clojure, and changed the command from lein repl to lein trampoline run -m clojure.main, which for some reason did the trick. I also changed the path to $file so you can open up a REPL while your project.clj is the current tab in Sublime, and the REPL should inherit the project's settings.

For reference, the complete Packages/User/SublimeREPL/config/Clojure/Main.sublime-menu file (Packages is accessible via Preferences -> Browse Packages...) is as follows:

[
     {
        "id": "tools",
        "children":
        [{
            "caption": "SublimeREPL",
            "mnemonic": "r",
            "id": "SublimeREPL",
            "children":
            [
                {"caption": "Clojure",
                 "id": "Clojure",
                 "children":[
                    {"command": "repl_open",
                     "caption": "Clojure Trampoline",
                     "id": "repl_clojure",
                     "args": {
                        "type": "subprocess",
                        "encoding": "utf8",
                        "cmd": {"windows": ["lein.bat", "trampoline", "run", "-m", "clojure.main"],
                                "linux": ["lein", "repl"],
                                "osx":  ["lein", "repl"]},
                        "soft_quit": "\n(. System exit 0)\n",
                        "cwd": {"windows":"$file_path",
                                "linux": "$file_path",
                                "osx": "$file_path"},
                        "syntax": "Packages/Clojure/Clojure.tmLanguage",
                        "external_id": "clojure",
                        "extend_env": {"INSIDE_EMACS": "1"}
                        }
                    },
                    {"command": "clojure_auto_telnet_repl",
                     "id": "repl_clojure_telnet",
                     "caption": "Clojure-Telnet"}]}
            ]
        }]
    }
]
Mingle answered 20/1, 2014 at 23:17 Comment(2)
Great instructions thanks. Just for clarifications to Sublime newbies (like me) - the Packages/User/SublimeREPL/config/Clojure/Main.sublime-menu path referenced to above is as follows: C:\Users\MY_USERNAME\AppData\Roaming\Sublime Text 3\Packages\User\SublimeREPL\config\ClojureCongeneric
correct - I updated the answer to describe how to find the directory, as it may be in different locations for different users/versions of Windows.Mingle
I
1

I solved this problem with Git Bash Shell. I have used the shell script version of leiningen instead of lein.bat

This is the command I use:

["C:\\Program Files\\Git\\bin\\sh.exe", "-l", "--", "/d/lein.sh", "repl"]

assuming lein.sh is in d:\

lein trampoline command sometimes behaves differently from lein repl and could fail due to unknown reasons.

Ianthe answered 23/1, 2015 at 2:54 Comment(1)
Unfortunately this doesn't work - at least on my machine using Sublime Text 2. It indeed starts the REPL (in gitbash), but as with lein repl it never executes any expression and just hangs.Uuge

© 2022 - 2024 — McMap. All rights reserved.