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.
Oh! Great idea.
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 .
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 A bit of a late response here, but <C-n> and <C-p> have been added to navigate the autocomplete list.
@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 - it would be awesome to also be able to use those keys inside of other trees like search!
@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 can you explain in more detail what this means? and does it apply to only panels or also viewlets?
@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 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.
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)
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"
}
works like a charm ๐
@rebornix should we just put that in the readme? Or do you think we should do something else on our side?
Wouldn't it make sense that the VIM extension defines these commands with those keybindings if that is what any VIM user expects?
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 notifications@github.com
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
.
awesome
@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.
@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 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 Aha! Thanks for that ๐
If anybody else out there is interested in the ctrl+j and ctrl+k to move up/down in the workbench and autocomplete suggestion list (and have vim.useCtrlKeys disabled), here's the keymaps for that...
{
"key": "ctrl+j",
"command": "selectNextSuggestion",
"when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
},
{
"key": "ctrl+k",
"command": "selectPrevSuggestion",
"when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"
},
{
"key": "ctrl+j",
"command": "workbench.action.quickOpenNavigateNext",
"when": "inQuickOpen"
},
{
"key": "ctrl+k",
"command": "workbench.action.quickOpenNavigatePrevious",
"when": "inQuickOpen"
}
@bpasero Not sure if this has been suggested yet or not, but tracking down these commands made me realize how much I took for granted Atom's keybinding resolver mode. Adding something similar to vscode would be amazing. ๐
@rebornix how exactly do we query "when": "listFocus" in our code? That's the last missing piece of this puzzle.
@johnfn we can't query context key in extension, that's basically why we have so many context variables in contribution part.
the keymap posted by rebornix works in the explorer, search and extensions panel.
is it also possible to configure this for the git panel?
It should work in any tree or list widget (except for the "Find References" tree).
Is it possible to add gg/g as home/end in the explorer window?
Why don't we just add @rebornix 's keybindings by default and close this issue?
On master, we have added the following keybindings when you're inside the explorer list
G: go to the bottom of the list
gg: go to the top of the list
o: Opens and closes folders
<enter>: opens the current file in a new tab
<c-d>: Go down half a page
<c-u>: Go up half a page
j: Move down
k: Move up
enter for me just gives me the chance to rename it, it does not open it, everything else works correctly
Ok just note on macOS, it is Cmd+enter to open file, not just enter.
Due to this line (presumably to match default finder behavior where enter just renames..): https://github.com/Microsoft/vscode/blob/09473dd87f20971a58ad43a6e5dc7ed6c1e32dc1/src/vs/workbench/parts/files/browser/fileActions.contribution.ts#L240
The solution provided by @rebornix works except it's impossible to rename files in explorer with "j,k" characters. Any idea how to fix this?
@alexbyk make sure your when clause matches this....
"when": "explorerViewletVisible && filesExplorerFocus && !inputFocus"
That said, j and k are preset by VSCodeVim so you shouldn't even have to map those.
@dsifford thanks. Looks like I missed an update on this
@xconverge cmd + enter doesn't work for opening a file on my Mac. Is anyone else having the same problem?
Edit: Whoops I see its the L key. https://github.com/VSCodeVim/Vim/issues/2372
Most helpful comment
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