简体   繁体   中英

How to jump to file explorer in VS Code?

Using the VIM extension for VS Code is there a key command to jump to the explorer pane and then back to the work window?

I cannot find anything in the docs.

I'm hoping there is something like my Control+N binding for NERDTree which lets me open the file viewer, pick a file and then close it.

I am not familiar with NERDTree, but I think Ctrl+Shift+e does what you are asking in vs code. Alternatively Ctrl+p may be an alternative? You could look at linux keyboard shortcut for more reference .

The link is also available in Help > Keyboard Shortcut Reference

EDIT: I'm adding the equivalent shortcut for Mac OS since it's different layout. However, I don't use Mac OS.. So I add this without being able to confirm :

Shift+Command+E Mac OS Keyboard shortcut for VS Code

Windows keyboard shortcuts are very similar to linux ones. So, I'll just include the link to windows shortcuts doc here. Windows Keyboard shortcut for VS Code

Just my two cents:

If you are using the Vim extension for VS code you can add this to your settings.json file:

"vim.normalModeKeyBindings": [
  {
    "before" : ["<leader>","a"],
    "commands" : [
      "workbench.view.explorer"
    ]
  }
]

The exemple above uses <leader> + a while in normal mode to display the file explorer where you can navigate the file list with j and k. Pressing ENTER will open the file under the cursor and close the file list.

To set up a leader key just add in your settings.json:

"vim.leader" : "," ,

In addition to Santiago's comment, you're able to open a file in a new tab from the explorer (Cmd + Shift + E) with Ctrl + Enter for MacOS. I'm not sure about Windows or Linux.

If you want to go to a file with VIM in VSCode:

Enter Normal Mode (Esc)

Place cursor over file you want to jump to, eg between the quotes - "../models/postMessage.js";

Press lowercase gd - Go to definition

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM