Replace with next value (ctrl shift dot) in Visual Studio Code

前端 未结 3 1523
长发绾君心
长发绾君心 2021-01-04 23:24

Does anyone know how \"Replace with next value\" (ctr + shift + dot) works ?

I am unable to get this shortcut to do anything on my vscode.

I tried googling

相关标签:
3条回答
  • 2021-01-05 00:00

    Add to the accepted answer:

    1. If you use it on a boolean, it toggles between true and false.
    2. No need to "highlight" the number, putting the cursor on it is enough.
    0 讨论(0)
  • 2021-01-05 00:12

    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.

    0 讨论(0)
  • 2021-01-05 00:24

    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" },
    
    0 讨论(0)
提交回复
热议问题