【问题标题】:sublime text 3 not sending code to sublimeREPLsublime text 3 不向 sublimeREPL 发送代码
【发布时间】:2017-11-20 21:20:03
【问题描述】:

我安装了 Sublime Text 3。我安装了 Package Control、R-Box、SendText、SendCode、sublimeREPL 和 1337 Color Scheme。为了测试 REPL R 是否正常工作,我运行了代码:

getwd()

输出是

R:/R_WD.

这是正确的位置。 我想要做的是将代码从一个窗口发送到 REPL R 并对其进行评估。它最初会将代码发送到 REPL R 窗口,我可以运行代码,但我希望能够让它自动运行。我尝试在论坛上寻找想法并更改了一些设置。现在它不会向 REPL R 发送代码了。

这是我的设置: 首选项 --> 包设置 --> R-Box --> 设置:

{
   // enable auto completions
   "auto_completions": true,

   // show popup hints
   "show_popup_hints": true,

   // path to Rscript, for example
   // (mac, linux): "/usr/local/bin/Rscript"
   // (windows):    "C:\\Program Files\\R\\R-x.y.z\\bin\\Rscript.exe"
   "rscript_binary": null,

   // additional paths to PATH variable
   "additional_paths": []
}

用户:

{
  "prog": "Cmder",
}

首选项 --> 包设置 --> SendText --> 设置---> 默认值:

{
    // Uncomment the program you want send text to:
    "program": "Terminal.app",
    // "program": "iTerm",
    // "program": "tmux",
    // "program": "screen",
    "paths":
    {
        // It might be necessary to explicitly set path (usually /usr/bin
        // or /usr/local/bin) to tmux and screen. Uncomment below and specify
        // the correct path:
        // "tmux": "/usr/local/bin/tmux",
        // "screen": "/usr/local/bin/screen"
    }
}

首选项 --> 包设置 --> SendText --> 设置---用户:

    {
      "prog": "Cmder",
    }

首选项 --> 包设置 --> SendCode--> 设置:

    {
       "prog": "Cmder",
    }

Preferences --> Package Settings -->SublimeREPL--> Settings---默认:

{
    // default_extend_env are used to augment any environment variables
    // that should be visible for all subprocess repls launched within
    // SublimeREPL. This is a very good place to add PATH extension
    // once "PATH": "{PATH}:/home/username/mylocalinstalls/bin" or whatever
    "default_extend_env": {},

    // Specify whether to move repls to a different Sublime Text group (frame)
    // immediately on opening. Setting this to true will simply move it to
    // the 'next' group from the one that was in focus when it was opened
    // (one down with row layout, one to the right with column and grid
    // layout). Alternatively, you can set this to the index of the group in
    // which you want all repls to be opened (index 0 being the top-left group).
    // Activating this option will NOT automatically change your layout/create
    // a new group if it isn't open.
    "open_repl_in_group": true,

    // Persistent history is stored per REPL external_id, it means that all python
    // REPLS will share history. If you wish you can disable history altogether
    "persistent_history_enabled": true,

    // By default SublimeREPL leaves REPL view open once the underlying subprocess
    // dies or closes connection. This is useful when the process dies for an unexpected
    // reason as it allows you to inspect it output. If you want. Setting this
    // to true will cause SublimreREPL to close view once the process died.
"view_auto_close": false,

    // On POSIX system SublimeText launched from GUI does not inherit
    // a proper environment. Often leading to problems with finding interpreters
    // or not using the ones affected by changes in ~/.profile / *rc files
    // This command is used as a workaround, it's launched before any subprocess
    // repl starts and it's output is parsed as an environment
"getenv_command": ["/bin/bash", "--login", "-c", "env"],

    // Some terminals output ascii color codes which are not currently supported
    // enable this option to filter them out.
"filter_ascii_color_codes": true,

    // Where to look for python virtualenvs
"python_virtualenv_paths": [
    "~/.virtualenvs",  // virtualenvwrapper
    "~/.venv"  // venv.bash https://github.com/wuub/venv
],

    // Use arrows for history navigation instead of Alt+[P|N]/Ctrl+[P|N]
"history_arrows": true,

    // standard sublime view settings that will be overwritten on each repl view
    // this has to be customized as a whole dictionary
    "repl_view_settings": {
        "translate_tabs_to_spaces": false,
        "auto_indent": false,
        "smart_indent": false,
        "spell_check": false,
        "indent_subsequent_lines": false,
        "detect_indentation": false,
        "auto_complete": true,
        "line_numbers": false,
        "gutter": false
    },

    // this settings exposes additional variables in repl config files, especially
    // those related to sublime projects that are not available through standard API
    // WARNING: this will switch your build system back to Automatic each time a REPL
    // is started so beware!
    "use_build_system_hack": false,

    // IP address used to setup autocomplete server in sublimerepl.
    // changing this is usefull when you want to exclude one address
    // from proxychains/tsocks routing
    "autocomplete_server_ip": "127.0.0.1",

    // Mapping is used, when external_id of REPL does not match
    // source.[xxx] scope of syntax definition used to highlight
    // files from which text is being transfered. For example octave
    // repls use source.matlab syntax files and w/o this mapping text transfer
    // will not work
"external_id_mapping": {
    "octave": "matlab"
},

    // If set to true, SublimeREPL will try to append evaluated code to repl
    // output before evaluation (e.g. Ctrl+, f)
    "show_transferred_text": true,

    // If set to true repl view (tab) that receives text for evaluation will
    // be brought to front after text transfer. Note: This will not fire if repl 
view
    // is in the same tab group as the view from which the code is sent.
    "focus_view_on_transfer": true
}

Preferences --> Package Settings -->SublimeREPL-->Settings--- 用户:

{
    "default_extend_env": {"PATH": "{PATH};R:\\R_WD\\R\\R-3.4.2\\bin\\x64"},
    "show_transferred_text": true
}

我注意到 cmets 说要取消注释或添加代码,但我似乎无法在这些位置编辑代码。 任何帮助表示赞赏。如果需要任何说明,我很乐意提供更多信息。

【问题讨论】:

    标签: r sublimetext3


    【解决方案1】:

    这就是我更改代码以使其工作的方式:

    我将“首选项-->包设置-->发送文本-->设置---用户:”从:

    {
      "prog": "Cmder",
    }
    

    到:

    {"r" : {
           "prog": "cmder",
        }
        { "rscript_binary" :  "R:\\R_WD\\R\\R-3.4.2\\bin\\Rscript.exe"
        }
    }    
    

    所有其他用户设置代码:

    {
      "prog": "Cmder",
    }
    

    我改成:

    {"r" : {
           "prog": "cmder",
        }
    }    
    

    我现在可以发送代码以使用默认选项自动评估。

    【讨论】:

      猜你喜欢
      • 2014-12-06
      • 2015-03-21
      • 1970-01-01
      • 1970-01-01
      • 2012-10-06
      • 2015-07-29
      • 2014-02-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多