Set working directory to location of active script in SublimeREPL

て烟熏妆下的殇ゞ 提交于 2019-12-05 16:12:49
desa

I had the same question and found an answer here.

For Python and IPython, in your Packages/User folder, create SublimeREPL/config/Python/Main.sublime-menu, where you specify "cwd": "$file_path" :

[
    {
        "id": "tools",
        "children":
        [{
            "caption": "SublimeREPL",
            "mnemonic": "r",
            "id": "SublimeREPL",
            "children":
            [
                {
                    "caption": "Python",
                    "id": "Python",

                    "children":[
                        {
                            "command": "repl_open",
                            "caption": "Python - Anaconda",
                            "id": "repl_python",
                            "mnemonic": "p",
                            "args": {
                                "type": "subprocess",
                                "encoding": "utf8",
                                "cmd": ["/path/to/Anaconda/python", "-i", "-u"],
                                "cwd": "$file_path",
                                "syntax": "Packages/Python/Python.tmLanguage",
                                "external_id": "python",
                                "extend_env": {"PYTHONIOENCODING": "utf-8"}
                            }
                        },
                        {
                            "command": "repl_open",
                            "caption": "IPython - Anaconda",
                            "id": "repl_python_ipython",
                            "mnemonic": "p",
                            "args": {
                                "type": "subprocess",
                                "encoding": "utf8",
                                "autocomplete_server": true,
                                "cmd": ["/path/to/Anaconda/python", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
                                "cwd": "$file_path",
                                "syntax": "Packages/Python/Python.tmLanguage",
                                "external_id": "python",
                                "extend_env": {
                                    "PYTHONIOENCODING": "utf-8",
                                    "SUBLIMEREPL_EDITOR": "$editor"
                                }
                            }
                        }
                    ]
                }
            ]
        }]
    }
]

I guess, for R it is the same.

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