Vscode: Open file with `arrow up`/`arrow down` in Explorer

Created on 3 Sep 2019  路  7Comments  路  Source: microsoft/vscode

When in Explorer, open the selected file on up arrow/down arrow.

This issue is similar to #55816 and some context can be read in that thread. All the following users were intervenients on that issue and might also be interested to contribute to this conversation: @isidorn, @RMacfarlane, @barelabs, @justinlevi, @MiLeung, @krisnye.

*out-of-scope feature-request file-explorer

Most helpful comment

For those that came here, here's the solution I came up with (my solution uses j/k but just replace with up/down and I'm sure you'll get the same thing). Would just like to share since I was surprised there wasn't something like this already.

  1. Download the multi-command extension
  2. Set up the following command in your settings.json (multiCommand.navigateExplorerDownAndPreviewFile/multiCommand.navigateExplorerUpAndPreviewFile can be whatever you want):

    "multiCommand.commands": [
    {
      "command": "multiCommand.navigateExplorerDownAndPreviewFile",
      "sequence": ["list.focusDown", "filesExplorer.openFilePreserveFocus"]
    },
    {
      "command": "multiCommand.navigateExplorerUpAndPreviewFile",
      "sequence": ["list.focusUp", "filesExplorer.openFilePreserveFocus"]
    }
    ]
    
  3. Then set the following in keybindings.json:

    {
    "key": "j",
    "command": "multiCommand.navigateExplorerDownAndPreviewFile",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
    },
    {
    "key": "k",
    "command": "multiCommand.navigateExplorerUpAndPreviewFile",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
    }
    

I just have l set up to run list.select to _actually_ open the file if I want to edit it, but you could set it up with right if you want to keep an arrowkeys-focused workflow.

All 7 comments

As @krisnye wrote on #55816:

When using the up and down arrow keys in the file explorer panel to navigate between files it would be good for the file you have selected to be opened in Preview mode.

As I wrote on #55816::

having the files previewed on arrow-up/arrow-down would be consistent with the default existing behavior of previewing the contents on mouse-click, and would improve user experience while browsing the codebase.

Thanks for opening this feature request.
Currently we do not have plans to tackle this thus assigning to the backlog, however we might revisit this in the future. Thanks!

hey @isidorn, no problem, but then I don't get the suggestion to create this issue if it was to be discarded ... anyway, thank you for your time; cheers

This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

Would really like to see this feature. If you want a quick demo of the UX, you can try Sublime Text 3 which implements preview as suggested.
Completely agree with @gerardolima that this is super nice for exploring a new codebase, especially on an OS that does not have quick-view directly in the filesystem explorer.

For those that came here, here's the solution I came up with (my solution uses j/k but just replace with up/down and I'm sure you'll get the same thing). Would just like to share since I was surprised there wasn't something like this already.

  1. Download the multi-command extension
  2. Set up the following command in your settings.json (multiCommand.navigateExplorerDownAndPreviewFile/multiCommand.navigateExplorerUpAndPreviewFile can be whatever you want):

    "multiCommand.commands": [
    {
      "command": "multiCommand.navigateExplorerDownAndPreviewFile",
      "sequence": ["list.focusDown", "filesExplorer.openFilePreserveFocus"]
    },
    {
      "command": "multiCommand.navigateExplorerUpAndPreviewFile",
      "sequence": ["list.focusUp", "filesExplorer.openFilePreserveFocus"]
    }
    ]
    
  3. Then set the following in keybindings.json:

    {
    "key": "j",
    "command": "multiCommand.navigateExplorerDownAndPreviewFile",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
    },
    {
    "key": "k",
    "command": "multiCommand.navigateExplorerUpAndPreviewFile",
    "when": "explorerViewletVisible && filesExplorerFocus && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus"
    }
    

I just have l set up to run list.select to _actually_ open the file if I want to edit it, but you could set it up with right if you want to keep an arrowkeys-focused workflow.

Was this page helpful?
0 / 5 - 0 ratings