DEV Community

Cover image for How Fig improved my ZSH experience (Fig Autocomplete Tutorial Pt. 1)

Posted on

How Fig improved my ZSH experience (Fig Autocomplete Tutorial Pt. 1)

Load times are the Achilles' heel of a well-configured ZSH terminal. We’re going to look at how Fig can improve your ZSH experience and make you feel like a seasoned pro when using your terminal. I can never go back.

In my opinion, the best way to decide if doing something in the terminal is worth it - is - does it save you time? While it can be beneficial to practice some stoicism and force the utilization of the command line. You don't want a git add . slowing down that PR you need to get out.

I've been serious about the terminal since my first "tech" job as an IT support guy when I was 18. I remember buying a command-line book, learning the 101s like cd and ls -la, and feeling like I was finally starting to tame this beast called the 13-inch Macbook Pro. Ever since that job I could rely on my basic terminal skills to get through a few headaches and perform some file copying magic.

My terminal swagger remained largely unchanged, even through my internship. It wasn't until I went full-time and got a new laptop a year later. This Macbook had a new default shell - ZSH. I can't quite recall what didn't work from the get-go, but it forced me to explore this foreign entity called ZSH. Google told me it was better than bash, and then I found this article: iTerm2 + zsh + oh-my-zsh The Most Power Full Terminal on macOS.

It was clear that spending a few hours learning about ZSH, customizing a config file, and integrating it with VsCode could really improve my productivity. I was right, the autocomplete, highlighting, and branch status is something I probably couldn't live without. However, there was something always lingering.

Oh-my-zsh slow load times because of plugins.

Now look, I didn't audit my zsh plugin list until today. I am sure with a bit of TLC I could've marginally improved my loading times. I actually found this great article that easily shows you what plugins are taking the longest to load. However, I needed these crutches.

I learned that it took my terminal about 1.3 seconds to fully load. With the number of times I open a terminal in VsCode this feels like 5+ seconds. Again, the functionality was so useful I shrugged it off. Then one day - I solved the problem of long ZSH load times without even trying to.

Seeing the light

Fig elighqment has been the biggest improvement in developer experience, for me, for as long as I can remember. I know things like Git and VsCode are bigger deals historically, but while I've been a conscious (aka dutifully employed lol) developer, this is it. It takes ZSH plugins and makes them look like a kid's toy. To put it simply, Fig adds VsCode style autocomplete to your terminal. Type in any command you typically use, and a non-invasive dropdown pops up with suggestions. The best part about Fig?

It just works.

Fig just working in VsCode

After a few hours with Fig, I realized that this is the way the terminal should be. Often, I have a pretty good idea what command I need to run, but having hints along the way makes sure I don't leave something out. Most importantly, I think the combination of ZSH and Fig is what makes it so world-changing. Computers shouldn't feel like black boxes, and neither should the terminal.

After realizing fig can do basically everything I ever needed in a terminal, the need for things like auto-jump went away. I also don't need plugins as Fig's is simply better. After deleting a plugin after plugin, my load time was cut in over half! ZSH feels snappy as ever and I as feel more confident than ever!

In part 2 of this series, I will talk about how easy it is to add an autocompletion spec and peel back the covers on some of the magic!

Nicholas Oxford

Discussion (0)