How to quickly open files with your editor

Victor Boissiere
Apr 2, 2018 · 1 min read

I often need to open a specific file in a deeply nested folders project. ZSH globbing does help but I wanted to have something faster.

Most of the time I already know the exact name of the file I want to open with my favorite editor $EDITOR . The only thing I need to do is to find the first matching file in my current tree that matches the filename I want to edit.

Here’s a quick look of how my solution works.

Image for post
Image for post

Below the snippet to make it work. Simply paste it into your .bashrc/.zshrc file.

Enjoy! 🎉

UPDATE: I've also made an autocomplete function that works with zsh.

Here is how it looks like:

Image for post
Image for post
Simple example for matching two files or a single file with autocomplete on

Simply paste the following code in .oh-my-zsh/custom/vs.zsh

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store