I know that it is possible to show the Sublime Text "Find and Replace" panel using the show_panel
command (either via a keybinding or a plugin), and control which arguments are enabled/disabled.
Example run from Sublime Console panel:
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 })
What I would like to know, is: is there a way to pre-populate the Find What:
and Replace With:
values?
I found this forum post but it has no reply, and the unofficial documentation is of no help in this case.
I have tried:
'find_what': 'string'
'replace_with': 'string'
'find_history': 'string'
'replace_history': 'string'
'find_history': ['string']
'replace_history': ['string']
'find': 'string'
'replace': 'string'
EDIT: I have also tried:
characters
find_characters
look_for
search_for
find_regex
find_string
search_string
replacement
search_characters
and none of the above makes any difference - the panel is always pre-populated with the previous search and replace values, not what I pass in.
I am aware of the commands slurp_find_string
and slurp_replace_string
, which will take the current selection and update the Find What
/ Replace With
values respectively, but I would like a way to do it without having to mess around with selections first - I just want to pass the values as arguments directly to the show_panel
command.
Does anyone know what parameters/arguments can be used to control this?
find_string
andreplace_string
? – Hartshornwindow.run_command("show_panel", {"panel": "replace", "find_string": "foo", "replace_string": "baz"})
opens the panel, but doesn't populate the text boxes... – Hartshorn