How to use the console within Sublime Text

旧城冷巷雨未停 提交于 2020-02-18 05:13:06

问题


I'm using Sublime Text 2 to code my programs, and want to run the console within it to compile and run them. Is there any way to embed the console command line inside Sublime Text 2? Is it already there?

I'm using both Windows and Linux.


回答1:


I think you can try creating a custom Build System. Tools --> Build System --> New Build System... This is a simple build script for the C programming language:

{
    "cmd" : ["gcc", "$file", "-o", "$file_base_name"],
    "cmd" : ["$file_base_name"],
    "selector" : "source.c",
    "shell" : true,
    "working_dir" : "$file_path"
}

Change the current build system to the new one in Tools. When you press CTRL + b it will compile your code and run your executable file. A few syntaxes and options that you can use: http://sublimetext.info/docs/en/reference/build_systems.html There are definitely many more other options that you can declare in the build system. A very useful one is file_regex.


回答2:


Terminus is a recent plugin, highly under development. It's the best cross-platform console in Sublime Text that I have seen yet.




回答3:


Will Bond created an excellent plugin for called "Terminal" for calling the terminal at project or file levels.

There are also several plugins available that compile at the click of a button:

  • "C# Compile & Run"
  • "Type​Script Compiler"
  • "Coffee​Compile"

...and so on, depending on your programming language.

I recommend browsing Will's "Package Control" page if you are not happy with this terminal plugin.



来源:https://stackoverflow.com/questions/20831043/how-to-use-the-console-within-sublime-text

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