Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyboard shortcuts for navigating working files in Visual Studio Code

I'm a web developer accustomed to Sublime Text. Often I'll have multiple files open and will navigate between them with cmd + option + left (or +right).

I'd love to have something as close to this functionality as possible in Visual Studio Code. From what I've read, in Visual Studio Code it sounds like instead of having multiple documents open in tabs across the top, you're supposed to use the "Working Files" list in the sidebar on the left. A few questions:

  • Is there a keyboard shortcut for navigating between these files sequentially? (the equivalent to cmd + option + left (or +right) in Sublime Text?)
  • Is there a keyboard shortcut for closing a file and removing it from the working files list? cmd + w just closes its editor window.
  • If these shortcuts don't exist by default, can I create them?

I did just discover Ctrl + - and Ctrl + shift + - (ref), which navigate between "edit locations." This is handy, but sometimes it jumps around between different locations in the same file (depending on where you've been editing). Also I would love an option that moved through files sequentially, i.e not based on most recently viewed, but rather top-to-bottom according to how they are listed in the Working Files list.

like image 788
launchoverit Avatar asked Jun 12 '15 23:06

launchoverit


People also ask

How do I navigate between files in VS Code?

Hold Ctrl and press Tab to view a list of all files open in an editor group. To open one of these files, use Tab again to pick the file you want to navigate to, then release Ctrl to open it. Alternatively, you can use Ctrl+Alt+- and Ctrl+Shift+- to navigate between files and edit locations.

How do I navigate in Visual Studio?

To navigate directly to a procedure or other member of a class, choose it in the right drop-down. To shift focus from the code window to the navigation bar, press the shortcut key combination Ctrl+F2. To shift focus from box to box on the navigation bar, press the Tab key.

What is Ctrl K in VS Code?

To launch the Define Keybinding widget, press Ctrl+K Ctrl+K. The widget listens for key presses and renders the serialized JSON representation in the text box and below it, the keys that VS Code has detected under your current keyboard layout.


2 Answers

I like the idea of having commands for closing a working file or closing all working files and I can look into adding those for the next update.

As for navigation between working files: We have a very powerful tool for navigation called Navigate History. By default it is assigned to Ctrl + Tab and you can leave the Ctrl key pressed and click Tab to cycle through the list of files, similar how you can switch between windows on the OS.

Navigate history is not identical to what you are asking for because it also contains files that you opened that are not in working files. Can you give it a try and report back if it solves the navigation problem for you?

We feel that this is a more natural way of navigating, because you don't have to worry about the order of working files. Instead you navigate across the list of most recently used files.

In our team we are so used to Navigate history that we cannot live without it anymore. Very often we would press Ctrl + Tab one or two times without even looking at the list that opens because we know that the file we want was either one or two history entries away.

Update

With the release of Visual Studio Code 0.5.0 there are now keyboard shortcuts to navigate back and forward in the list of working files. The shortcut is CMD + K + and CMD + K + (on Windows use the Ctrl key).

like image 154
Benjamin Pasero Avatar answered Sep 22 '22 11:09

Benjamin Pasero


Ctrl + Page Up

Ctrl + Page Down

would be the best answer for navigating sequential tabs.

like image 21
bk jung Avatar answered Sep 23 '22 11:09

bk jung