Embracing Neovim
It's well known that most developers use VS Code. This shouldn't be a surprise to anyone because beginners will always prefer to start with something that "Just Works" (TM), and chances are they'll go with whatever most people are already using.
A very common pattern in developers (and computer users in general) is that once they get used to some tool, they'll refuse to try something different. This includes what operating system they have installed, what programming languages they write and, of course, what text editor they use.
In contrast, there are people that will instead be more curious and willing to try different things to see if they can improve their workflow in any way. It was this curiosity what motivated me to learn about Linux and eventually become good at using the terminal.
I wanted to know if there would be a text editor that would fit better into my workflow, and to do this I had to put aside what I was familiar with and start learning stuff from a different perspective.
These are the main things I wanted to change about my workflow:
-
I wanted to use a smaller program. Something that can run smoothly on a toaster and doesn't need to run a damn web browser engine to work, especially when you just want to edit simple text files.
-
I wanted to reduce mouse usage. Yes, a good number of GUI editors have some sort of plugin or extension to enable Vim motions, but you still need to reach the mouse for other actions besides editing.
-
I wanted to minimize switching between my terminal emulator window and other programs. If I could run my editor from the terminal, I would be able to switch between tasks more quickly (tmux perfectly complements this), and that means even less need for the mouse. Additionally, knowing how to use a terminal-based text editor is a must if you need to edit text files when running a remote shell.
So, I only had to run vimtutor
, memorize every Vim trick in existence and
uninstall every other form of text editing software I had installed, right?
Well, it's not really that simple. There are some features that I consider
essential for working in large projects, the main ones being:
- A proper completion system that understands the language I'm writing.
- Being able to jump to definitions and references across files.
- Integration with linting and formatting tools.
- Syntax highlighting that doesn't have a negative impact on performance when opening large files (vanilla Vim is known for having this problem).
During my research I found Neovim and the coc.nvim plugin. This was good enough as a starting point and made it easier for me to make the jump from typical IDEs.
Around that time, the Neovim 0.5.0
release was right around the corner. This
release added support for writing the configuration files in Lua (init.lua
)
instead of Vimscript (init.vim
), and introduced native LSP and Tree-sitter
support. Every subsequent release has improved these features and their APIs,
and plugins written in Lua have progressively become better.
I wrote my Neovim configuration entirely from scratch, adding and removing plugins as I needed. This takes a lot of time, so I only recommend this approach to people that enjoy this process of customizing stuff, like I do.
There are a handful "Neovim distributions" like LunarVim and NvChad that offer initial setups that include all the features I listed above and more, but instead I recommend using a configuration template like kickstart.nvim because it's more flexible and has a structure that is simpler and cleaner than most of these distributions, and includes comments as documentation for helping with customization.