【问题标题】:Sublime Text open a specific file with the command palette or key bindingSublime Text 使用命令面板或键绑定打开特定文件
【发布时间】:2014-08-15 15:35:41
【问题描述】:

如何使用自定义命令选项板条目或键绑定(即快捷键)打开特定文件?

有些文件我经常打开,但与任何特定项目无关。能够使用命令面板或键绑定快速打开它们会很有用。

【问题讨论】:

    标签: sublimetext2 sublimetext sublimetext3


    【解决方案1】:

    花了几分钟的时间试错才能弄清楚如何做,但这里是如何做到的。

    要在命令面板中添加一个条目以打开特定文件,请将以下模板的修改版本添加到您的用户 Default.sublime-commands 文件中。

    // Modify the caption "File Open: Whatever" to something
    // appropriate and of course change the file path.
    
    { "caption": "File Open: Whatever", "command": "open_file", 
      "args": {"file": "/path/to/whatever"} },
    

    要添加键绑定以打开特定文件,请将以下模板的修改版本添加到您的用户 Default (OS).sublime-keymap 文件中。

    // Modify the key bindings to what you want and change the file path.
    
    { "keys": ["ctrl+t", "ctrl+w"], "command": "open_file", 
      "args": {"file": "/path/to/whatever"} },
    

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-04
      • 1970-01-01
      • 1970-01-01
      • 2015-01-04
      • 1970-01-01
      相关资源
      最近更新 更多