Sublime Forum

Single key navigation without conflict with text fields

#1

I’d like to be able to switch files with single keys like this:

{"keys":["1"]	,"command":"prev_file_tab"}                      	,//|super+shift+[|super+pageup  |ctrl+pageup  |
{"keys":["2"]	,"command":"next_file_tab"}                      	,//|super+shift+]|super+pagedown|ctrl+pagedown|

But this breaks typing since text boxes aren’t considered a special text mode that would pause non-modifier keybinds and prioritize alpha keys

I’d like to limit some keybinds to non-text fields only to avoid that

0 Likes

#2

You should be able to add a context with a control check:

{
    "keys":["1"],
    "command":"prev_file_tab",
    "context": [{ "key": "control", "operator": "not_equal", "operand": "text_control" }]
}

see docs: https://www.sublimemerge.com/docs/key_bindings#context

1 Like

#3

Thanks for the suggestion, but it doesn’t work, these keys still fire up even inside text controls

Strangely enough, when I change to equal, then the keys only work within text controls

(Windows 10 build 2091)

0 Likes

#4

This might work as an override for text controls: (not sure on SM’s behavior with the insert command like this)

{
    "keys":["1"],
    "command":"prev_file_tab"
},
{
    "keys":["1"],
    "command":"insert",
    "args": {"characters": "1"},
    "context": [{ "key": "control", "operator": "equal", "operand": "text_control" }]
}
1 Like

#5

Thanks for this workaround, at first glance seems to work, so will use that until SublimeHQ fixes the bug

1 Like