I want to use the keyboard only to navigate inside and manipulate list views in VS Code, such as
How can I do this?
The keyboard shortcuts you're interested in are listed in the keyboard shortcuts UI with IDs all starting with "list.
".
In short, to move focus, you can use the arrow keys- Up and down arrow keys go up and down, and left and right arrow keys can be used to expand and collapse nested things. Left inside something nested can be used to jump to the parent of the nest, and enter can be used to select the focused item, and space on the parent of a nest can be used to toggle expand/collapse of it. Hold ctrl and use arrow keys to scroll, and hold shift and use arrow keys to extend or contract the selection. And other goodies (read on).
The full definition of default keybindings on Windows and Linux is as follows (you can find this in the defaultKeybindings.json pseudo file by using the Preferences: Open Default Keyboard Shortcuts (JSON)
in the command palette- they're probably largely the same on macOS- just using cmd instead of ctrl):
{ "key": "up", "command": "list.focusUp", "when": "listFocus && !inputFocus" },
{ "key": "down", "command": "list.focusDown", "when": "listFocus && !inputFocus" },
{ "key": "home", "command": "list.focusFirst", "when": "listFocus && !inputFocus" },
{ "key": "end", "command": "list.focusLast", "when": "listFocus && !inputFocus" },
{ "key": "pageup", "command": "list.focusPageUp", "when": "listFocus && !inputFocus" },
{ "key": "pagedown", "command": "list.focusPageDown", "when": "listFocus && !inputFocus" },
{ "key": "ctrl+down", "command": "list.scrollDown", "when": "listFocus && !inputFocus && listScrollAtBoundary != 'both' && listScrollAtBoundary != 'bottom'" },
{ "key": "ctrl+up", "command": "list.scrollUp", "when": "listFocus && !inputFocus && listScrollAtBoundary != 'both' && listScrollAtBoundary != 'top'" },
{ "key": "space", "command": "list.toggleExpand", "when": "listFocus && !inputFocus" },
{ "key": "right", "command": "list.expand", "when": "listFocus && treeElementCanExpand && !inputFocus || listFocus && treeElementHasChild && !inputFocus" },
{ "key": "left", "command": "list.collapse", "when": "listFocus && treeElementCanCollapse && !inputFocus || listFocus && treeElementHasParent && !inputFocus" },
{ "key": "ctrl+left", "command": "list.collapseAll", "when": "listFocus && !inputFocus" },
{ "key": "enter", "command": "list.select", "when": "listFocus && !inputFocus" },
{ "key": "ctrl+shift+enter", "command": "list.toggleSelection", "when": "listFocus && !inputFocus" },
{ "key": "shift+down", "command": "list.expandSelectionDown", "when": "listFocus && listSupportsMultiselect && !inputFocus" },
{ "key": "shift+up", "command": "list.expandSelectionUp", "when": "listFocus && listSupportsMultiselect && !inputFocus" },
{ "key": "ctrl+a", "command": "list.selectAll", "when": "listFocus && listSupportsMultiselect && !inputFocus" },
{ "key": "escape", "command": "list.clear", "when": "listFocus && listHasSelectionOrFocus && !inputFocus" },
{ "key": "f3", "command": "list.find", "when": "listFocus && listSupportsFind" },
{ "key": "ctrl+f", "command": "list.find", "when": "listFocus && listSupportsFind" },
{ "key": "escape", "command": "list.closeFind", "when": "listFocus && treeFindOpen" },
You can customize these to your heart's content.
Note that not all lists have the same capabilities, so you might observe some differences in what these keybindings do in context. For example, in lists that have no concept of selecting things (in the sense of multiple selection of items), the selection keybindings may do nothing or just move focus, and in lists that have no concept of selecting something (in the sense of selecting a single thing to perform some associated action of its), the selection keybinding might just do something like toggle expansion.