Replace with next value (ctrl shift dot) in Visual Studio Code
If I press the shortcut after highlighting an integer or float literal (16
or 5.2
for example) it subtracts 1 from it.
Strangely, Replace with Previous Value
adds 1 to the value while Replace with Next Value
subtracts 1.
I don't know if it has any other purpose.
Add to the accepted answer:
- If you use it on a boolean, it toggles between
true
andfalse
. - No need to "highlight" the number, putting the cursor on it is enough.
As noted by @Félix Caron, this is how to swap the two keys.
keybindings.json
{ "key": "ctrl+shift+oem_period", "command": "editor.action.inPlaceReplace.up", "when": "editorTextFocus && !editorReadonly" },
{ "key": "ctrl+shift+oem_comma", "command": "editor.action.inPlaceReplace.down", "when": "editorTextFocus && !editorReadonly" },
Moreover, in my case as I have breadcrumbs enabled "breadcrumbs.enabled": true,
, the replaceUp key triggered breadcrumbs instead, so I had to unbind it.
{ "key": "ctrl+shift+oem_period", "command": "-breadcrumbs.toggleToOn", "when": "!config.breadcrumbs.enabled" },
{ "key": "ctrl+shift+oem_period", "command": "-breadcrumbs.focusAndSelect", "when": "breadcrumbsPossible" },