guettli
guettli

Reputation: 27107

ctrl-e to switch between two files in visual studio code

Most people use alt+TAB to switch between applications on their desktop.

This question is about switching between two windows in Visual Studio Code.

I am used to use ctrl-e to switch between two files in PyCharm and Chrome (via plugin Quick Tab).

Now I would like to do the same in vs-code.

The short cut ctrl-e opens the change file dialog. But if I hint "enter", I stay in the same file. I would have to use the down-arrow key to change the file.

Since I can blindly switch between two files in PyCharm and Chrome with ctrl-e ENTER, I would like to do the same in vs-code. How can I configure it this way?

Upvotes: 5

Views: 3025

Answers (2)

Peter L
Peter L

Reputation: 3361

I found workbench.action.showAllEditorsByMostRecentlyUsed to be the most like JetBrains Rider / Intellij although a extra 'Down' keystroke is needed afterwards. It shows the most-recently-used editors and does not disappear when I release the shortcut chord.

Steps:

  1. File | Preferences | Keyboard Shortcuts
  2. Paste workbench.action.showAllEditorsByMostRecentlyUsed in the search at top
  3. Replace the existing binding with Ctrl+e
  4. Remove other Ctrl+e bindings if necessary

Upvotes: 1

Mark
Mark

Reputation: 182781

In your keybindings.json:

File > Preferences > Keyboard Shortcuts. "Open Keyboard Shortcuts" (top right).

{
    "key": "ctrl+e",
    "command": "workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup"
  },
  {
    "key": "ctrl+tab",
    "command": "-workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup"
  },

See this issue: https://github.com/Microsoft/vscode/issues/6923

Upvotes: 5

Related Questions