sublime text使用

sublime text使用过程中遇到的一些问题记录。

1. st支持输入命令行参数

[1] ctrl + shift + p 快捷键呼出命令面板,搜索install package,选择安装,等待响应,之后搜索Shell-Turtlestein,安装。
ctr + shift + c呼出插件,即可输入命令行。

在我机器上仍然报错,shell_cmd or cmd is required。
[2] 经测试验证该方法可解决:

  • Open folder %APPDATA%\Sublime Text 3\Packages or just click Preferences -> Browser Packages
  • Create a folder named CMD (Uppercase). The path of CMD should be %APPDATA%\Sublime Text 3\Packages\CMD.
  • Open the folder CMD, and create a file, named cmd.py (lowercase), paste the context as below:

    import os, sublime_plugin
    class CmdCommand(sublime_plugin.TextCommand):
    def run(self, edit):
    file_name=self.view.file_name()
    path=file_name.split("\")
    current_driver=path[0]
    path.pop()
    current_directory="\".join(path)
    command= "cd "+current_directory+" & "+current_driver+" & start cmd"
    os.system(command)
  • Create a file (again), named Context.sublime-menu. Add context as below:

    [
    { "command": "cmd" }
    ]
  • The Cmd function will work in context menu (right-click). For example:
sublime text使用_第1张图片
Paste_Image.png

Of cause, if you want to open command line by command (by 'cmd' for example), you can add the following context into Default (Windows).sublime-keymap file. :

{ "keys": ["c", "m", "d"], "command": "cmd"}

You can open it from Preferences -> Key Bindings - User

ref:
[1] http://blog.csdn.net/xiangsimoyinjiu/article/details/51130138
[2] http://stackoverflow.com/questions/18606682/how-can-i-open-command-line-prompt-from-sublime-in-windows7?noredirect=1

你可能感兴趣的:(sublime text使用)