How Neovim helped improve my productivity
As any journey starts, mine began a year ago when I watched multiple videos/shorts from ThePrimeagen on effectively using Vim in his workflow. The way he used shortcuts and navigated around the editor ignited a spark inside me to give Vim a try.
Before discovering Vim, I identified as a devoted WebStorm user due to my pre-existing familiarity with Android Studio — an IntelliJ-based IDE. Given my dual responsibilities of writing front-end code for an Android app and concurrently developing backend solutions, it was clear for me to embrace the JetBrains rich IDE ecosystem.
I experimented with VSCode for a few weeks, but it consistently felt distinct to the extent that it seemed like certain features were always missing, less intuitive than what Webstorm had consistently done better. Even after installing and configuring multiple plugins to enhance the VSCode experience, it always seemed like an editor rather than a fully-fledged IDE. The tooling provided by Webstorm is so potent, and my prior experiences with JetBrains products have always been positive. Choosing Webstorm over VSCode was a straightforward decision for me.
Vim as your Editor
During this time I was consuming a lot of tech content on YouTube/Twitch, ThePrimeagen, teej_dv, tsoding who, in their own unique ways, incorporated command line editors into their workflows whether it was Vim or Emacs. When I saw them move at such a pace within their editor I immediately realized that this is something I should learn.
The “Vim as your Editor” playlist from ThePrimeagen made me realize that you don’t need Vim software to improve your efficiency rather he focused on Vim motions. Vim motions are the idea of having Vim key bindings applied to any tool to enhance productivity. Motions like hjkl
2j
dt)
ciw
within your editor improve the way you move around text. Several tools also support Vim motions including IDEs and browsers, but they are most commonly seen to be used within text editing software.
So, I began using the IdeaVim Plugin, which introduces Vim motions to IntelliJ-based IDEs. In the initial days, I found it challenging to adapt to the new hjkl
motions instead of the familiar arrow keys. Subsequently, I configured the vim-be-good plugin with Neovim, even though I wasn’t fully using Neovim. I knew this plugin would aid in improving my proficiency in Vim motions, so I practiced it daily whenever I found the time. Within a week, these fundamental key bindings became ingrained in my muscle memory, enabling me to navigate, perform relative jumps to lines, find words, and carry out basic text replacement/deletion and other tasks within Webstorm efficiently.
A month went by, and I became extremely proficient with these motions. It’s worth noting that I used to type with only two fingers, an uncomfortable typing method that caused pain in my fingers. This meant I couldn’t type continuously for an extended period without cracking my finger knuckles. During this period of learning Vim motions, I also started learning touch typing. It was challenging because I not only had to master hjkl
but also press them using the correct fingers, a habit I was not accustomed to. However, driven by determination, I practiced and became comfortable with both touch typing and Vim motions. Within a month, my typing speed increased from 60 words per minute to 100 words per minute.
Neovim as my primary editor
Two months passed by with Vim motions in Webstorm, and I decided it was time to go full in Vim. I chose Neovim because it had Lua support rather than editing config in VimScript, also it is a community-driven project so releases are pretty often, and has a rich plugin ecosystem. However, rather than writing my own configuration, out of laziness, I chose to use an existing Neovim distribution. AstroNvim caught my attention as it appeared first in Google search results for distros, and the homepage had a cool vibe. I didn’t even know about other distributions like Lazy, Lunar, and NvChad at that time.
Like other distributions, AstroNvim has good sensible defaults. Everything is already set up for projects like Python, Node, Rust, Go etc. At first, I was very confused about how to navigate between Neovim buffers especially getting in and out of Neotree and Toggleterm, both very good plugins but for me it was a skill issue. There were a lot of challenges I faced during the initial setup of Neovim like getting to display icons correctly, correct “TERM” variable and also on Mac you have to disable font smoothing for your terminal otherwise the edges of text look smudgy and many many things which at this point I forgot.
I then moved to Alacrity along with Tmux for managing my sessions, one for work and others for personal projects that never got completed, and now I have dangling unused sessions. Tmux was a great addition to my overall setup as I can have multiple windows and panes without opening a new terminal window. With plugins like tmux-resurrect (for saving sessions across computer restart), tmux-yank (for copying any text within a window) my development experience became 10x.
Several months passed with me using AstroNvim as my IDE for various projects. At this point, I found myself bragging in front of my colleagues at work about my proficiency with Vim and how quickly I had adapted. I knew there was no turning back to using a GUI editor. I became so obsessed with terminal programs that opening a GUI felt like cheating, especially since I was also using Hacker News and Spotify TUI right within my Tmux session. Even tasks like making changes to a directory, such as finding files, grouping them into a subdirectory, renaming, and zipping, were nothing more than a series of multiple grep, sed, awk, find, and tar piping operations.
What I felt was the idea of switching to Neovim made me more close to the command line.
Problems I faced with AstroNvim
It’s not that the distro has issues, but to me, AstroNvim felt overly configured to the point where I wasn’t utilizing many of its features. Making edits to the configuration was also quite confusing; adding a new plugin or editing existing configurations often felt challenging due to its highly abstracted code. As a beginner with limited knowledge of Lua and Vim APIs, grasping all the intricacies became very tough.
So, one weekend, I took on the challenge to rewrite my configuration from scratch while maintaining all the required feature parity with AstroNvim, including its remaps. Instead of opting for a starter kit like kickstart.nvim or quick.nvim, I decided to begin from scratch. The Vim RC video from The Primeagen and LazyVim served as a valuable starting point, helping me understand the directory structure and providing custom configuration settings for some Neovim plugins.
I was able to go from 6k+ lines to 1.2k lines (reference PR). However, it’s not about the number of lines that matters most to me, but the fact that I can now navigate through my entire configuration and make edits comfortably.
Two cents for beginners planning to start Vim
- Get comfortable with Vim motions within your IDE first. IdeaVim for Intellij-based IDEs and Vim for VSCode. Here is my
.ideavimrc
file for some basic remaps. - Familiarize yourself with basic terminal commands like grep, awk, sed, and find, as some Neovim plugins like telescope and spectre will require them. This will make it easier for you to configure basic search /replace settings.
- When planning to go full NeoVim start with a distro like LazyVim, NvChad, etc., and see if you can wrap your minds around concepts like buffers, tabs and are comfortable navigating around. The switch may not be subtle; initially, you’ll face challenges and be slower in tasks like browsing files, search/replace, and other LSP refactoring tools. However, since you’re using a distribution, most of these will be configured for you.
- Eventually, start understanding your distro config and get familiar with basic vim APIs and options in
vim.opt
. Use:help
for reading API and plugin docs. Many plugin maintainers write good documentation but it would be tiresome for people who are not friendly with reading text-only docs rather than some fancy stuff like markdowns. - At any moment you feel like your distro is becoming too overwhelming to edit and configure, it may be a good sign to write your config from scratch. Don’t edit upon kickstart.nvim or quick.nvim as your base source, keep them as a reference. These starter kits are not magic so it would be best for you to understand them and start from scratch. You will be copying a bunch of config settings from other sources and it is okay.
- Use a VCS for your config, so any fuck-ups can easily be reverted.
- Once everything starts to feel stable try using a terminal multiplexer like tmux or zellij. It can help you keep your multiple sessions active even on a remote machine.
- These all points cannot be done in a day, it will take time as it did for me “a whole year”.
Conclusion
Vim is not a key to become productive it is just a tool (to flex). At the end of the day if you are comfortable around your editor then keep using it but just become good at it.
My job involves heavy use of EC2 machines and ssh’ing into production servers and pods. An environment where there is no display/graphical unit was the main reason for me to switch from Webstorm to Vim so I could have a consistent personalized development experience across different workstations.
If you like my way of writing, you can follow me on Twitter (X).