美文网首页
sublime text使用

sublime text使用

作者: 九楼记 | 来源:发表于2017-04-05 10:34 被阅读0次

    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:
      <pre><code>
      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)
      </pre></code>
    • Create a file (again), named Context.sublime-menu. Add context as below:
      <pre><code>
      [
      { "command": "cmd" }
      ]
      </pre></code>
    • The Cmd function will work in context menu (right-click). For example:
    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使用

          本文链接:https://www.haomeiwen.com/subject/onstattx.html