VS Code does not have the ability to perform most file actions with commands. You need to hop into the File Explorer and get busy with your mouse most of the time. 🤕 I would like to stick to the keyboard for these actions, so I was looking for an extension to do this for me.
There are some decent options available in the marketplace, but they tend to focus on a niche such as creating a new file (advanced-new-file), or they take a different approach to what I would like (File Utils). This is the
Move active file command from File Utils. It requires you to edit a filepath, which I think is poor UX.
What I would love is an extension that covers all file actions in a consistent, intelligent way. I decided to prototype what I would do differently. Enter File Bunny. 🐰
Below I showcase a few commands and describe how I have made this process easier. If you have some feedback, I’d love to hear it!
Use consolidated lists for quick file selection
For some actions, we can make a consolidated list of the files for quick selection.
File Bunny: Move Active File command, a QuickPick dialog lets you choose from all folders (and subfolders) in your workspace.
You can see how this can be more efficient and less error-prone than the equivalent command in File Utils. It narrows the list to matched selections as you type, the same behaviour as the Command Palette.
You can exclude folders from the list with an
excludes settings option to keep the list lean. This is similar to the
Files: exclude setting that exists in VS Code already.
Use incremental completion to find files quickly
Modal file dialogs suck! It would be more efficient to use the keyboard to find files, but how can we do this without hacking filepaths?
We can use incremental completion to build the path quickly.
Take the command,
File Bunny: Open a Folder.
In this example, I do the following to open my Beer Advisor project:
- Type “and”, which highlights the Android folder as the first option. Press Tab to select it.
- Type “beer”, which highlights the beer-advisor folder as the first option. Press Tab to select it.
- Accept the current directory (first option) by pressing Enter to open it.
This process of building paths is quick and can help you find what you’re looking super fast.
You can also walk the file system with the arrow keys when you need to search around to find something. Use the left arrow to go back, and right arrow to go forward through the file system.
Actions for the active file
Quite often, you want to do something to a file you’re already working on. It seems silly to find it in the file explorer in the sidebar, and then perform an action on it.
Just, run a command such as
File Bunny: Delete Active File and it’s done! The file is deleted (put into trash). Focus is switched to the next open file, so you can carry on without needing to switch view. Other extensions don’t do this, you need to click to get back to the editing context!
Give File Bunny a try, and let me what you think! I’ve been using myself for a couple of weeks and love using it so far (as biased as that sounds)!