Sublime Forum

Toggling caps-sensitivity of search via keyboard

#1

I’m wondering if there’s an API to toggle the caps-sensitivity option of the Find panel.

~ never-ending quest not to use my trackpad ~

0 Likes

#2

Keyboard or API?

The default keybinding on Windows is:

	{ "keys": ["alt+c"], "command": "toggle_case_sensitive", "context":
		[
			{ "key": "setting.is_widget", "operator": "equal", "operand": true }
		]
	},

You can find that via Preferences -> Keybindings.

As for API, not sure, but check https://www.sublimetext.com/docs/3/api_reference.html and if there is nothing specific you can always use window.run_command (or view.*) to emulate the key event.

0 Likes

#3

Thanks… now that I’ve learned to look at the online API a bit, I’ve forgotten to check the pre-existing keyboard shortcuts… :slight_smile:

(Btw, do you know what’s the effect of the setting.is_widget condition?)

0 Likes

#4

The is_widget setting is applied by Sublime to all of the text input widgets, such as the find inputs in the find panel, the input area in the command palette, etc. The setting makes sure that the key only takes effect when the cursor is in one of those places as opposed to while you’re editing a file, for example.

So in this case, that context ensures that the key binding is only in effect when the cursor is in one of those places, such as when the find panel is open; otherwise it is inactive so that it doesn’t get in the way of a more useful general purpose key binding.

0 Likes

#5

I see. Thank you!

0 Likes