Home > Blockchain >  Does VSCode have a hotkey/shortcut for "toggle replace", switching between "find"
Does VSCode have a hotkey/shortcut for "toggle replace", switching between "find"

Time:06-24

Visual Studio Code has a search and replace widget with a little dropdown button that toggles between one-line search mode and two-line replace mode. If you hover the pointer over it there's a tooltop saying "Toggle Replace".

search mode replace mode

Almost every function I've ever wanted a hotkey for in VSCode has had one, and I can find them by looking in the View/Command Palette... menu. But there doesn't seem to be a hotkey for this one. Unless it's confusingly named or perhaps built-in and hence not listed?

I am aware that there are separate keys for "Find" and "Replace" and that the first one takes me to the top line or only line if the box is in "Find mode" and the second takes me to the bottom line, and puts the box in "Replace mode" if it is currently in "Find mode".

But sometimes I just want it to be back in Find mode when I don't intend to do any replacing, but I want to do it without having to use mouse/trackpad since I touchtype and my fingers are on the keyboard.

I know I don't need it but I keep wanting it. I know it's very minor.

Is there a way to put the Find and Replace widget back into single-line "Find" mode from the keyboard?

(I'm using the Mac version if that makes any difference.)

CodePudding user response:

From the keyboard, yes. If you use your Tab, Shift and Enter keys (Space also works instead of Enter), you can control this window. Note the blue outline around the selected control.

When you first open the Find box, it is focused in the text field of the text you want to find. If you do Shift Tab, it will move the focus to the arrow that toggles the replace line. Simply press Enter and you can open the replace textbox line. You can basically do this in reverse to then toggle the replace line to be hidden again.

enter image description here

  • Related