Sublime Text使用命令选项板或键绑定打开特定文件

mat*_*tst 2 sublimetext sublimetext2 sublimetext3

如何使用自定义命令调色板条目或使用键绑定又称快捷键打开特定文件?

我打开了一些文件,但没有与任何特定项目相关联.能够使用命令选项板或键绑定快速打开它们会很有用.

mat*_*tst 8

花了几分钟的试验和错误才弄清楚如何做到这一点,但是这里是怎么做的.

要在命令面板中添加条目以打开特定文件,请将以下模板的修改版本添加到用户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"} },
Run Code Online (Sandbox Code Playgroud)

要添加键绑定以打开特定文件,请将以下模板的修改版本添加到用户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"} },
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助.