Sublime Text 3 build system: keep console running

▼魔方 西西 提交于 2019-12-03 00:43:17

Ok, I've finally found a solution that runs the build system in an external xterm terminal. If you use this Sublime will open a xterm window and execute the build system there. This window remains open, so e.g. Matlab plot windows will not be closed after execution of the code. I've combined the build system with and without the external terminal into one build system:

{
    "cmd": ["/usr/local/MATLAB/R2013b/bin/matlab", "-nosplash", "-nodesktop", "-r \"run('$file');quit;\""],
"selector": "source.m",

"variants": [
    { 
        "name": "xterm",
        "cmd": ["xterm", "-e", "/usr/local/MATLAB/R2013b/bin/matlab", "-nosplash", "-nodesktop", "-r \"run('$file');\""]
    }
]
}

and then assigned a user key binding to access the xterm variant easily:

[
{ "keys": ["ctrl+shift+b"], "command": "build", "args": {"variant": "xterm"} }
]

This xterm solution should also work with any other interpreter that you want to prevent from being closed after code execution finishes.

An alternative method is to have both Sublime and Matlab open and then set up a script with AutoHotKey (Windows) or Autokey (Linux) that copies the filename or the code to evaluate and then pastes this in Matlab's command window.

The benefits of this method are:

  1. You maintain all of the useful features of MatLab as an IDE
  2. You can evaluate code snippets (the F9 feature) as well as the whole file

See detailed instructions for Linux or Windows

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