我重新映射了" replace_all" to to" super + enter"用于替换,但我偶尔会意外地使用它,如果查找/替换面板可见,我更愿意只允许此命令。我可以在args
对象中指定一个提供此条件的属性吗?
{ "keys": ["super+shift+enter"], "command": "replace_all", "args": {"close_panel": true} }
答案 0 :(得分:3)
您可以指定键绑定操作的context
。
例如,添加以下内容将确保只有在替换面板打开并具有焦点时才能激活键绑定:
"context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}]
您的最终密钥绑定可能如下所示:
{ "keys": ["super+shift+enter"], "command": "replace_all", "args": {"close_panel": true}, "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] }