且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将工作目录设置为SublimeREPL中活动脚本的位置

更新时间:2023-12-05 10:13:58

我遇到了同样的问题,并找到了答案

I had the same question and found an answer here.

对于Python和IPython,在Packages/User文件夹中创建SublimeREPL/config/Python/Main.sublime-menu,在其中指定"cwd": "$file_path":

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

我想,对于R来说,是相同的.

I guess, for R it is the same.