Vim icon indicating copy to clipboard operation
Vim copied to clipboard

Using j,k,l,i to navigate inside explorer list

Open tbson opened this issue 10 years ago • 37 comments

  • Click thumbs-up 👍 on this issue if you want it!
  • Click confused 😕 on this issue if not having it makes VSCodeVim unusable.

The VSCodeVim team prioritizes issues based on reaction count.


That's great if I can forget arrow keys when using VIM mode. That feature already have on Sublime & Atom but I can't find it on VSCode with VSCodeVim.

tbson avatar Sep 11 '16 02:09 tbson

Oh! Great idea.

jpoon avatar Sep 11 '16 02:09 jpoon

Currently we don't expose such extensibility for file explorer in Code but definitely I see the reason people want it. This feature request is tracked by https://github.com/Microsoft/vscode/issues/11517 and https://github.com/Microsoft/vscode/issues/4557 .

rebornix avatar Sep 13 '16 17:09 rebornix

Can we tack onto this the ability to use <c-j> and <c-k> (or something) to navigate the autocomplete list (while in insert mode, of course) as well, or should I open a new issue for that?

dallas avatar Oct 04 '16 18:10 dallas

@dallas A bit of a late response here, but <C-n> and <C-p> have been added to navigate the autocomplete list.

johnfn avatar Nov 30 '16 03:11 johnfn

@tbson would you expect to use these keys only in the explorer or any tree inside VS Code (there are many, e.g. search)?

bpasero avatar Feb 01 '17 17:02 bpasero

@bpasero - it would be awesome to also be able to use those keys inside of other trees like search!

johnfn avatar Feb 03 '17 04:02 johnfn

@bpasero just for your information, it would be a big plus if Code provides a command to move focus between panels only by position. Right now we can do that for grouped editors but no luck with panels I suppose.

rebornix avatar Feb 09 '17 16:02 rebornix

@rebornix can you explain in more detail what this means? and does it apply to only panels or also viewlets?

bpasero avatar Feb 09 '17 16:02 bpasero

@bpasero sorry for the misleading wording. In Vim with a file explorer extension, the explorer viewlet is treated as a window, just like the editing area. You can use ctrl+w + hjkl to navigate your cursor between these windows. So in VS Code, if the cursor is in the first grouped window, users would expect to use ctrl+w+h to move cursor the left side viewlet, no matter what it is.

It's also the same for panels, I'm not sure whether we already have a command for switching focus between visible editor/panel/viewlet. If not, that's what we need.

rebornix avatar Feb 10 '17 22:02 rebornix

@rebornix so let's assume you have explorer visible, 2 editors side by side and panel. Pressing ctrl+w h would focus the explorer, how would jkl navigate in this layout? And I assume it would only navigate between visible windows, not bring up hidden ones? Maybe best to file this as issue in the VS Code repo.

bpasero avatar Feb 11 '17 07:02 bpasero

Configurable tree/list commands are added for February release via https://github.com/Microsoft/vscode/issues/11517 (see https://github.com/Microsoft/vscode/issues/11517#issuecomment-278418472 for a list of new commands)

bpasero avatar Feb 20 '17 07:02 bpasero

We don't need to wait for any update from Vim side to experience this feature, right now you can bind you navigation keys to new tree/list commands @bpasero introduced in 1.10, like below

    {
        "key": "j",
        "command": "list.focusDown",
        "when": "listFocus"
    },
    {
        "key": "k",
        "command": "list.focusUp",
        "when": "listFocus"
    },
    {
        "key": "enter",
        "command": "list.select",
        "when": "explorerViewletVisible && filesExplorerFocus"
    },
    {
        "key": "o",
        "command": "list.toggleExpand",
        "when": "listFocus"
    }

rebornix avatar Mar 01 '17 23:03 rebornix

works like a charm 👍

misoguy avatar Mar 02 '17 00:03 misoguy

@rebornix should we just put that in the readme? Or do you think we should do something else on our side?

xconverge avatar Mar 02 '17 04:03 xconverge

Wouldn't it make sense that the VIM extension defines these commands with those keybindings if that is what any VIM user expects?

bpasero avatar Mar 02 '17 05:03 bpasero

Yes, we can put these keybindings in our package.json, which is a better solution to users. On Wed, Mar 1, 2017 at 21:30 Benjamin Pasero [email protected] wrote:

Wouldn't it make sense that the VIM extension defines these commands with those keybindings if that is what any VIM user expects?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/VSCodeVim/Vim/issues/754#issuecomment-283560562, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1heLE8pzWZKx-jSdV3uYnQ7KAuzZenks5rhlP1gaJpZM4J54mw .

rebornix avatar Mar 02 '17 05:03 rebornix

awesome

xconverge avatar Mar 02 '17 06:03 xconverge

@rebornix

Yes, we can put these keybindings in our package.json, which is a better solution to users.

Any idea when we should expect this to land? Doesn't look like this was included in Cupcake Copier.

dsifford avatar Mar 06 '17 03:03 dsifford

@bpasero I'm looking through the changes now on this and I can't seem to figure out how to target specifically the up/down navigation of the workbench and autocomplete suggestion lists.

Any tips?

(for these situations, in order to map hjkl and still be able to type, my preference is to map ctrl+[hjkl] to the navigation commands).

Thanks in advance!

dsifford avatar Mar 06 '17 03:03 dsifford

@dsifford not sure when it will land, you can use the rebinding he posted, and then we already have bindings for autocomplete suggestion lists ctrl+n and ctrl+p, so if you want to you could rebind ctrl+j to ctrl+n etc...

xconverge avatar Mar 06 '17 04:03 xconverge