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

时间:2014-08-15 15:35:42

标签: sublimetext2 sublimetext sublimetext3

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

有些文件我打开很多但与任何特定项目无关。能够使用命令调色板或使用键绑定快速打开它们将非常有用。

1 个答案:

答案 0 :(得分: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"} },

要添加密钥绑定以打开特定文件,请将以下模板的修改版本添加到用户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"} },

希望这有帮助。