【发布时间】:2016-07-22 06:39:57
【问题描述】:
我知道可以使用show_panel 命令(通过键绑定或插件)显示 Sublime Text“查找和替换”面板,并控制启用/禁用哪些参数。
从 Sublime 控制台面板运行示例:
window.run_command('show_panel', { 'panel': 'replace', 'regex': True, 'case_sensitive': False, 'whole_word': False, 'in_selection': False, 'wrap': True, 'highlight': True, 'preserve_case': True })
我想知道的是:有没有办法预先填充 Find What: 和 Replace With: 值?
我找到了this forum post,但没有回复,unofficial documentation 在这种情况下也无济于事。
我试过了:
'find_what': 'string''replace_with': 'string''find_history': 'string''replace_history': 'string''find_history': ['string']'replace_history': ['string']'find': 'string''replace': 'string'
编辑:我也试过:
charactersfind_characterslook_forsearch_forfind_regexfind_stringsearch_stringreplacementsearch_characters
以上都没有任何区别 - 面板总是预先填充了以前的搜索和替换值,而不是我传入的值。
我知道命令 slurp_find_string 和 slurp_replace_string,它们将分别采用当前选择并更新 Find What / Replace With 值,但我想要一种方法来做到这一点而不必乱来首先选择 - 我只想将值作为参数直接传递给 show_panel 命令。
有谁知道可以使用哪些参数/参数来控制它?
【问题讨论】:
-
愚蠢的问题,但你试过
find_string和replace_string吗? -
该死,它似乎对我不起作用:
window.run_command("show_panel", {"panel": "replace", "find_string": "foo", "replace_string": "baz"})打开面板,但没有填充文本框...
标签: sublimetext3 sublime-text-plugin