Skip to content

Commit

Permalink
vscode: Configure breadcrumbs to work like vim-vinegar
Browse files Browse the repository at this point in the history
I've been using Vim for a while now and I'm trying out Visual Studio
Code. One thing I have been missing a lot is the ability to navigate
between files in the way that vim-vinegar enables.

Using this plugin in Vim, I can press - and be taken into a file
browser, starting in the directory that the current file is in.
Selecting a file opens it, and pressing - again traverses up a directory
level.

https://stackoverflow.com/questions/54834068/replacement-for-vim-vinegar-in-vs-code

I think I can replicate the experience I want using breadcrumbs. This
commit represents my first attempt at this by:

- enabling breadcrumbs
- adding a vim normal mode keybinding of `-` to enable and focus
  breadcrumbs
- adding a keyboard shortcut of `-` while breadcrumbs are visible to
  navigate "up a level"

This isn't perfect yet, specifically pressing enter on a directory does
nothing, but it is a big step in the right direction.
  • Loading branch information
lencioni committed Feb 22, 2019
1 parent 91e3e89 commit 2357591
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
7 changes: 7 additions & 0 deletions vscode/keybindings.json
Expand Up @@ -3,4 +3,11 @@

// From https://code.visualstudio.com/docs/getstarted/userinterface#_working-without-tabs
{ "key": "cmd+w", "command": "workbench.action.closeEditorsInGroup" },

// Make breadcrumbs work more like vim-vinegar
{
"key": "-",
"command": "breadcrumbs.focusPrevious",
"when": "breadcrumbsActive && breadcrumbsVisible",
},
]
19 changes: 18 additions & 1 deletion vscode/settings.json
@@ -1,4 +1,6 @@
{
"breadcrumbs.enabled": true,

// Prevent typing things like `.` and `;` from accepting autocomplete suggestions
"editor.acceptSuggestionOnCommitCharacter": false,

Expand Down Expand Up @@ -134,7 +136,22 @@
"args": []
}
]
}
},

// vim-vinegar
{
"before": ["-"],
"commands": [
{
"command": "breadcrumbs.toggleToOn",
"when": "!config.breadcrumbs.enabled",
},
{
"command": "breadcrumbs.focusAndSelect",
"when": "breadcrumbsPossible",
},
],
},
],

/*
Expand Down

0 comments on commit 2357591

Please sign in to comment.