Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I toggle header/cpp file via keyboard shortcut in Visual Studio Code?

I'd like a simple keyboard shortcut to swap between the header (h, hpp) and CPP files. Visual Assist for Visual Studio allowed me to do this via ALT+O. Is there a similar keyboard binding for Visual Studio Code?

like image 600
void.pointer Avatar asked Sep 12 '16 14:09

void.pointer


People also ask

How do I toggle code in Visual Studio?

Usage. Set your cursor on a word or select a word and press the associated keybinding (Ctrl+r by default on macOS, Alt+r on Windows and Linux). You can also use the VS Code Command Palette and choose the Toggle command, or use the Toggle action in a context menu.

How do I set keyboard shortcuts in Visual Studio code?

All keyboard shortcuts in VS Code can be customized via the keybindings. json file. To configure keyboard shortcuts through the JSON file, open Keyboard Shortcuts editor and select the Open Keyboard Shortcuts (JSON) button on the right of the editor title bar. This will open your keybindings.


1 Answers

You can use the extension ms-vscode.cpptools to Switch Header/Source. If you're on Mac, then the shortcut is ⌥ O (option + O key). On windows, the shortcut is Alt+O.

Old answer:

There are currently a couple of extensions that support header/source file toggling:

  • bbenoist.togglehs
  • ryzngard.vscode-header-source

You can find more by searching the words "switch toggle header source" in the extensions tab in vscode.

like image 196
FluxLemur Avatar answered Oct 22 '22 14:10

FluxLemur