How I created a custom, efficient, and enjoyable work flow with Vim
Art Mazreku
Author

Art Mazreku

Date

May 16, 2023

Category

Development

As we (developers) all do, I love writing code and spending time on my computer to create something new. Either work-related projects, personal pet projects, or a script to automate some silly stuff that does not take too much time anyway. I also like to spend time learning new developer-centric technologies or tools that help with the way I do my job. Recently, I went through a process of changing how I organize and interact with my workflow that I wanted to share.

Changing Things Up

The pandemic brought a lot of changes to our lives, including changes in the way we work. As someone who has always been a fan of keyboard shortcuts, I was excited about the idea of a mouseless workflow. This led me to explore the world of Vim, a text editor designed for efficient text editing. At the same time, I was also experimenting with Linux, not realizing that I could swap the core OS functionality with alternatives and customize them to my liking.

As I delved deeper into the Vim editor, I realized that I was in a rabbit hole trying to reinvent the wheel by customizing my environment to fit my workflow. I discovered the idea of tiling window managers and ricing my OS, and I found the r/unixporn subreddit to be a great resource for learning from others' custom environments. However, most of the customizations there were just to make it look good and fancy. I wanted to apply the concept of "Editing in the speed of thought" to my entire environment.

Getting Started

I used both Windows and Linux at the time, and while customizations were easier on Linux, I tried to keep a similar workflow on both my machines. I have since switched to MacOS, and I will share some of the tools and customizations that I currently use in my workflow.

I use a tiling window manager called Yabai, which allows me to tile and manage windows efficiently. For keyboard shortcuts, I use Karabiner Elements and SKHD (Simple HotKey Daemon). I also use iTerm2 and Warp as my terminal emulator. My preferred shells are Fish and Zsh, but I stuck with Zsh in my Mac and I use both VSCode and NeoVim as my code editors. I also use Vimium C (for Chrome and Firefox) and Vimari (for Safari) as Vim browser extensions.

While I use VSCode with a Vim plugin as my primary editor. I aim for practicality instead of being religious to terminal apps only but I try to make both work as similar as possible.

With this setup, I get benefits from both the GUI and Terminal world.

Navigation is always dependent on H, J, K, and L, with a slight change in combinations depending on the scope of use (editor, terminal, OS). For example, in both editors, these letters are used as arrow keys (normal mode), and combining them with Right CMD provides system-wide arrow keys (including insert mode). Moving between VSCode panes uses Option combinations, while Option Shift is used for Yabai focus functions.

When working from my desk in the office, I like to benefit from 2 external monitors and my laptop screen. However, this was an issue for me because sometimes I had to work only with my laptop screen, which messed up the way my muscle memory used to operate. Instead of organizing apps based on displays, I changed it to use spaces. I set up 9 spaces: Web, Database, API, Code, Music, Terminal, Chat, Project Management, and Design. The apps that I use daily are automatically moved to their space based on the category. For example, the browser is on the Web space, and the editor is on the Code space. I can tie all of these spaces to a shortcut combining numbers 1-9, so instead of switching between apps (spaces) using Alt+Tab, I can simply do Cmd+4, and I’m focused on the code editor, no matter if I’m on a 3 monitor setup or 1. This way, I can edit at the speed of thought, and these shortcuts become muscle memory after a while.

The Payoff

The time and effort I have invested in configuring my workspace has paid off in terms of increased productivity and ease of use. The ability to switch between applications and workspaces seamlessly has made a significant difference in my workflow. I also gained new skills and knowledge by learning how to use command-line tools and scripting languages. It was challenging at times, but the satisfaction of creating something that works the way you want it to is indescribable.

However, it's important to remember that this type of customization and automation isn't for everyone. It takes time, effort, and a certain level of technical expertise to achieve. And even then, it's a matter of personal preference.

As a conclusion, did all these make me a faster coder? Probably not much, but for sure it doubled the fun factor and it allows me to only focus more on what I’m working on.

As an excuse for why all this makes sense to me, I’ll finish with a quote from Abraham Lincoln:

“Give me six hours to chop down a tree and I will spend the first four sharpening the axe.”