Sublime Text, SublimeREPL, Clojure & Windows 8

北慕城南 提交于 2019-12-04 05:01:50

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"}]}
            ]
        }]
    }
]

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!