@tansongyang @kingkeith @kakubei @stevenp @pablog @Cotton
[Notifications for people who have asked similar questions in other threads, Cotton’s was on StackOverflow.]
NOTE: Sublime Text 3 (untested with ST2).
I found the lack of key bindings for some of the options in the find, replace, and find/replace in files panels rather annoying as well.
This afternoon I had a play around with guessing the command names given that (although undocumented) it was known that the toggle_in_selection
command toggles the ‘in selection’ option. I managed to find all the commands with a little trial-and-error.
The undocumented commands and missing key bindings / shortcuts for toggling options in the find / replace / find in files panels
As far as I am aware, or can find with web searches, this is the first time all of these commands have been documented (with the exception of toggle_in_selection
).
I have no idea why these options do not already have key bindings in the Default (OS).sublime-keymap
files. I have opened an issue to have them added to the .sublime-keymap
files and to have the commands added to the unofficial documentation but neither of these are likely to be done for quite a while.
The options and their respective toggle commands are:
Commands to Toggle Find/Replace Panel Options - Not Documented Anywhere AFAICT
------------------------------------------------------------------------------
Toggle Wrap: Command: toggle_wrap
Toggle In Selection: Command: toggle_in_selection
Toggle Highlight Matches: Command: toggle_highlight
Toggle Show Context: Command: toggle_show_context (find/replace in files panel only)
Toggle Use Buffer: Command: toggle_use_buffer (find/replace in files panel only)
Example key bindings to use them are:
{ "keys": ["alt+p"], "command": "toggle_wrap", "context":
[
{ "key": "setting.is_widget", "operator": "equal", "operand": true }
]
},
{ "keys": ["alt+s"], "command": "toggle_in_selection", "context":
[
{ "key": "setting.is_widget", "operator": "equal", "operand": true }
]
},
{ "keys": ["alt+h"], "command": "toggle_highlight", "context":
[
{ "key": "setting.is_widget", "operator": "equal", "operand": true }
]
},
{ "keys": ["alt+t"], "command": "toggle_show_context", "context":
[
{ "key": "setting.is_widget", "operator": "equal", "operand": true }
]
},
{ "keys": ["alt+b"], "command": "toggle_use_buffer", "context":
[
{ "key": "setting.is_widget", "operator": "equal", "operand": true }
]
},
I’ve used alt+p
for toggle_wrap
since alt+w
is used by toggle_whole_word
and alt+t
for toggle_show_context
since alt+c
is used by toggle_case_sensitive
.
Clearly users can change these to whatever they prefer but I find that using the last letter is easy to remember for cases when the first letter is already taken.
OSX users should replace alt+
with super+alt+
in keeping with their existing find panel toggle option key bindings.
The ‘existing’ documented commands for toggling options in the find / replace panels
For the sake of completeness here are the rest of the commands to toggle find/replace panel options, these are already documented and have key bindings in the Default (OS).sublime-keymap
files.
Commands to Toggle Find/Replace Panel Options - Already Documented
------------------------------------------------------------------
Toggle Case Sensitive: Command: toggle_case_sensitive
Toggle Regex: Command: toggle_regex
Toggle Whole Word: Command: toggle_whole_word
Toggle Preserve Case: Command: toggle_preserve_case (replace panel only)
Hope this helps.