I meant to post this with my prior posts re: the VSCode File Explorer Menu extension. I wanted to write something detailing my current setup in VSCode that that attempts to mimic my VIM setup.
The first bit of settings are the ones I have setup in Keyboard Shortcuts (i.e. keybindings.json), the second set are the ones that are in the settings which are attached to VSCode VIM’s normal mode bindings (gist available here).
keybindings.json
Command | Key | When | Notes |
list.focusDown | j | explorerViewletVisible && filesExplorerFocus && !inputFocus | Goes to the next item in the file explorer. |
list.focusUp | k | explorerViewletVisible && filesExplorerFocus && !inputFocus | Goes to the previous item in the file explorer. |
workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup | ctrl+e | This opens up a list of most recently used files. | |
workbench.action.gotoSymbol | ctrl+f12 | This is technically from my Resharper days, but I decided to bring it over to VSCode. This opens a quick drop down of symbols in the file. | |
-workbench.action.openNextRecentlyUsedEditorInGroup | ctrl+tab | Opens the next tab. | |
-workbench.action.openPreviousRecentlyUsedEditorInGroup | ctrl+shift+tab | Opens previous tab. | |
workbench.action.toggleSidebarVisibility | , e w | filesExplorerFocus && !editorTextFocus | Toggles and focuses on file explorer. |
selectNextSuggestion | ctrl+j | suggestWidgetVisible | Picks next autocomplete suggestion. |
selectPrevSuggestion | ctrl+k | suggestWidgetVisible | Picks previous autocomplete suggestion. |
workbench.action.quickOpenSelectNext | ctrl+j | inQuickOpen | Similar as above but for opening the next quick open item. |
workbench.action.quickOpenSelectPrev | ctrl+k | inQuickOpen | Selects previous quick open item. |
search.action.focusNextSearchResult | ctrl+j | hasSearchResult && searchViewletVisible | Picks next search result when search widget is visible. |
search.action.focusPrevSearchResult | ctrl+k | hasSearchResult && searchViewletVisible | Picks previous search result when search widget is visible. |
settings.json
Before | Commands | Notes |
: | workbench.action.gotoLine | Jumps to specified line number. |
leader r | editor.action.referenceSearch.trigger | Searches for references under cursor. |
leader c t | workbench.action.closeEditorsInGroup | This is closes the “split”. I often will open a split, do some work, then trigger this command to close it back out. |
leader s t | workbench.action.files.showOpenedFileInNewWindow | This is probably one of the few things from VIM I wasn’t able to fully replicate, I used to pretty regularly use “:tab split” in Vim to create a new tab in VIM which was in it’s own way like a separate workspace (especially with plugins like Ctrl-Space). The closest I’ve come to replicating this in VSCode is to just open the file in a new window. Unfortunately it opens the file in complete isolation so you lose all of the project’s context. |
leader g d | editor.action.goToTypeDefinition | Jumps to type definition. |
leader g i | editor.action.goToImplementation | Jumps to type implementation. |
T | workbench.action.terminal.toggleTerminal | Opens up the Terminal. |
leader j | editor.action.marker.next | Jumps to the next error/warning. |
leader k | editor.action.marker.prev | Jumps to the previous error/warning. |
leader t | workbench.action.toggleSidebarVisibility | Toggles sidebar. |