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

About

Victor Boissiere

DevOps engineer & SRE

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