question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

modal navigation in VSCode explorer

See original GitHub issue

Love this extension! With the VSCodeVim extension, I can navigate the explorer pane (the tree view showing all files and folders) using j and k, just as in Vim. Is there a way to enable this modal motion using j and k in the tree view with this extension? Thanks!

I have been able to simulate this using the keybindings below but they require holding ctrl pressed. Would be nice if I didn’t need to use ctrl.

{
  "key": "ctrl+j",
  "command": "list.focusDown",
  "when": "!editorFocus"
},
{
  "key": "ctrl+k",
  "command": "list.focusUp",
  "when": "!editorFocus"
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

20reactions
theol0403commented, Dec 24, 2020

I’ve been meaning to make a full request for a while, containing a ton of bindings I made to make the vscode experience much better. If I don’t get around to making it soon, here is one relevant section. Inspiration from VSCodeVim bindings and vspacecode.

    // list navigation
    {
        "key": "g g",
        "command": "list.focusFirst",
        "when": "listFocus && !inputFocus"
    },
    {
        "key": "shift+g",
        "command": "list.focusLast",
        "when": "listFocus && !inputFocus"
    },
    {
        "key": "h",
        "command": "list.collapse",
        "when": "listFocus && !inputFocus"
    },
    {
        "key": "j",
        "command": "list.focusDown",
        "when": "listFocus && !inputFocus"
    },
    {
        "key": "k",
        "command": "list.focusUp",
        "when": "listFocus && !inputFocus"
    },
    {
        "key": "l",
        "command": "list.select",
        "when": "listFocus && !inputFocus"
    },
    {
        "key": "enter",
        "command": "list.select",
        "when": "listFocus && !inputFocus"
    },
    {
        "key": "o",
        "command": "list.toggleExpand",
        "when": "listFocus && !inputFocus"
    },
    {
        "key": "ctrl+u",
        "command": "list.focusPageUp",
        "when": "listFocus && !inputFocus"
    },
    {
        "key": "ctrl+d",
        "command": "list.focusPageDown",
        "when": "listFocus && !inputFocus"
    },
    {
        "key": "/",
        "command": "list.toggleKeyboardNavigation",
        "when": "listFocus && !inputFocus && listSupportsKeyboardNavigation"
    },
    {
        "key": "escape",
        "command": "list.toggleKeyboardNavigation",
        "when": "listFocus && inputFocus && listSupportsKeyboardNavigation"
    },
    // explorer actions
    {
        "key": "r",
        "command": "renameFile",
        "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
    },
    {
        "key": "d",
        "command": "deleteFile",
        "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceReadonly && !inputFocus"
    },
    {
        "key": "y",
        "command": "filesExplorer.copy",
        "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !inputFocus"
    },
    {
        "key": "x",
        "command": "filesExplorer.cut",
        "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !inputFocus"
    },
    {
        "key": "p",
        "command": "filesExplorer.paste",
        "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceReadonly && !inputFocus"
    },
    {
        "key": "v",
        "command": "explorer.openToSide",
        "when": "explorerViewletFocus && explorerViewletVisible && !inputFocus"
    },
    {
        "key": "a",
        "command": "explorer.newFile",
        "when": "filesExplorerFocus && !inputFocus"
    },
    {
        "key": "shift+a",
        "command": "explorer.newFolder",
        "when": "filesExplorerFocus && !inputFocus"
    },
    {
        "key": "n",
        "command": "explorer.newFile",
        "when": "filesExplorerFocus && !inputFocus"
    },
    {
        "key": "shift+n",
        "command": "explorer.newFolder",
        "when": "filesExplorerFocus && !inputFocus"
    },
    // panel nav
    {
        "key": "ctrl+b j",
        "command": "workbench.action.navigateDown"
    },
    {
        "key": "ctrl+b k",
        "command": "workbench.action.navigateUp"
    },
    {
        "key": "ctrl+b h",
        "command": "workbench.action.navigateLeft"
    },
    {
        "key": "ctrl+b l",
        "command": "workbench.action.navigateRight"
    },
    // sidebar control
    {
        "key": "ctrl+b",
        "command": "-vscode-neovim.send",
        "when": "editorTextFocus && neovim.ctrlKeysNormal && neovim.init && neovim.mode != 'insert'"
    },
    {
        "key": "ctrl+b",
        "command": "-workbench.action.toggleSidebarVisibility"
    },
    {
        "key": "ctrl+b b", // focus explorer
        "command": "workbench.files.action.focusFilesExplorer",
        "when": "!explorerViewletFocus"
    },
    {
        "key": "ctrl+b b", // exit sidebar
        "command": "workbench.action.focusActiveEditorGroup",
        "when": "explorerViewletFocus"
    },
    {
        "key": "escape",
        "command": "workbench.action.focusActiveEditorGroup",
        "when": "sideBarFocus"
    },
    {
        "key": "ctrl+b c", // toggle sidebar
        "command": "workbench.action.toggleSidebarVisibility"
    },
    {
        "key": "ctrl+b f", // focus file in explorer
        "command": "workbench.files.action.showActiveFileInExplorer"
    },
    {
        "key": "ctrl+b r", // replace project
        "command": "workbench.action.replaceInFiles"
    },
    {
        "key": "ctrl+b g", // replace file
        "command": "editor.action.startFindReplaceAction"
    },
    {
        "key": "ctrl+b e", // extensions
        "command": "workbench.view.extensions"
    },
    {
        "key": "ctrl+b a", // activity bar toggle
        "command": "workbench.action.toggleActivityBarVisibility"
    },
    {
        "key": "ctrl+b s", // status bar toggle
        "command": "workbench.action.toggleStatusbarVisibility"
    },
    {
        "key": "ctrl+b o", // focus outline
        "command": "outline.focus"
    },
    {
        "key": "ctrl+n", // activity bar nav
        "command": "workbench.action.nextSideBarView",
        "when": "sideBarFocus"
    },
    {
        "key": "ctrl+p",
        "command": "workbench.action.previousSideBarView",
        "when": "sideBarFocus"
    },
    {
        "key": "ctrl+b m",
        "command": "workbench.action.maximizeEditor",
    },

Edit: Oh yes, and there needs to be a crucial setting configuration:

  "workbench.list.automaticKeyboardNavigation": false,
4reactions
theol0403commented, Dec 31, 2020

@David-Else Kind of - the solution is to use https://marketplace.visualstudio.com/items?itemName=pascalsenn.keyboard-quickfix .

    // open quickfix
    {
        "key": "ctrl+.",
        "command": "keyboard-quickfix.openQuickFix",
        "when": "editorHasCodeActionsProvider && editorTextFocus && !editorReadonly"
    },
Read more comments on GitHub >

github_iconTop Results From Across the Web

modal navigation in VSCode explorer · Issue #457 - GitHub
With the VSCodeVim extension, I can navigate the explorer pane (the tree view showing all files and folders) using j and k ,...
Read more >
Code Navigation in Visual Studio Code
The Explorer is great for navigating between files when you are exploring a ... VS Code provides two powerful commands to navigate in...
Read more >
Mouseless Code Editing with VS Code | by alpha2phi - Medium
For VS Code, to support modal editing, there are mainly 2 extensions we can use ... Navigate between Terminal, Editor, and File Explorer....
Read more >
How to create a modal for a VSCode extension?
VS Code (1.34) has no concept modal UI. Extensions can only show basic dialog messages modally using the showMessage apis.
Read more >
Creating and Managing Modal Dialog Boxes - Visual Studio ...
Visual Studio Code. When you create a modal dialog box inside Visual Studio, you must make sure that the parent window of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found