I'm learning to use Positron, an IDE built on Code OSS (the same foundation as VS Code). I want to be able to create a keybinding that jumps (without user interaction) to the next occurrence of a pattern, without further user interaction.
For instance, I believe I can trigger the "search" dialog to open, and then I type in the pattern (aka the default find). In this case, though, I want a specific hard-coded pattern so that I press the keybinding and the cursor moves immediately (with no further action).
I think the json format for keybindings.json is preferred, but if there's a more native-code method then I'm amenable. Ultimately this will be combined with other actions with
{
"command": "runCommands",
"args": [ "command1", "command2",...]
}
I'd prefer a native solution without extensions.
In keybindings.json:
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+alt+shift+f",
"command": "runCommands",
"when": "editorTextFocus",
"args": {
"commands": [
{
"command": "editor.actions.findWithArgs",
"args": {
"searchString": "fizzbuzz|fizz|buzz",
"isRegex": true
}
},
"editor.action.nextMatchFindAction",
"closeFindWidget",
]
}
},
]
This "opens" the find widget, populates it, goes to the next match, then closes it. The widget never visibly opens.
Based loosely on this answer.