mac 系统上 sublime 的一个神秘快捷键
场景
在 sublime 中查找一个单词(mac 系统上)
原有方案
询问了两个 sublime 的资深用户,他们是这样做的:
- 双击选中这个单词
command
+c
command
+f
command
+v
最初使用时,我也是这样做的,感觉很麻烦,强大的 google 搜索到了一个 command
+ e
,这样上面的步骤便是这样:
1. 双击选中这个单词
2. command
+ e
3. command
+ f
虽然减少了一个步骤,但是仍然感觉麻烦。
于是想到通过宏的录制来合并第二部和第三部,无奈失败了,宏录制的时候无法正确录制这两个命令。
只能先这样了(因为平时用的不多)。
直到有一天,使用的频率增加了。
打开快捷键的配置文件,找到了 command
+ e
和 command
+ f
,分别是:
[
...
{ "keys": ["super+e"], "command": "slurp_find_string" },
{ "keys": ["super+f"], "command": "show_panel", "args": {"panel": "replace", "reverse": false} },
...
]
其实把这两个 command 合并一下就可以了,但是 sublime 默认是不支持一个快捷键配置两个 command 的。
走了弯路的方案
三生万幸(python 真心不会),找到了一个
ChainOfCommand
配置步骤
- 使用 Package Control 安装 ChainOfCommand 插件(别告诉我你不会)
- 打开快捷键配置
- 在右边填写新的
command
+f
快捷键
[
...
{
"keys": ["super+f"],
"command": "chain",
"args": {
"commands": [
["slurp_find_string"],
["show_panel", {"panel": "find", "reverse": false}]
]
}
}
...
]
这样就可以选中这个单词直接 command
+ f
进行查找了。
哪里不会找哪里。
妈妈再也不用担心我 command
+ c
command
+ v
了。
老司机给的方案
折腾了半天不如老司机的一行啊!
经过老司机的提示,发现原来 sublime 默认是支持选择查找的,只不过在 mac 系统上被覆盖了
command + ,
打开设置
{
// If true, the selected text will be copied into the find panel when it's
// shown.
// On OS X, this value is overridden in the platform specific settings, so
// you'll need to place this line in your user settings to override it.
"find_selected_text": true,
}
这样只需要在右边复制一行 "find_selected_text": true
即可。
惭愧惭愧。