Open current editing file in explorer tree

Couldn’t live with no complete answer, so figured out the following:

Without a direct keyboard shortcut:

  1. Open the command palette via CmdShiftP (or Cmd+P then >) and type Files: Reveal Active File in Side Bar.
  2. This reveals the active file in the side bar similar to Visual Studio’s Alt+Shift+L

Then, take the above and map a keyboard shortcut to it:

  1. Open keyboard shortcut preferences file via CmdShiftP followed by Preferences: Open Keyboard Preferences File.
  2. Add in the following (taking Visual Studio’s lead, I’ve personally mapped it to Alt+Shift+L, but map to what you want).
// Place your key bindings in this file to overwrite the defaults      
[
  {
    "key": "shift+alt+l",
    "command": "workbench.files.action.showActiveFileInExplorer",
  },
]

Note that it’s not as good as Visual Studio, Atom, etc. in that you can’t then navigate with arrow keys in the tree (arrow keys navigate the active file contents), but I guess I’ll eventually figure out how to do that.

@Tomoyuki Aota points out that you can do the following to navigate with arrow keys:

After Files: Reveal Active File in Side Bar, press Ctrl+Shift+E (Show
Explorer). After that, I can navigate the files in the explorer by the
arrow keys.

Leave a Comment