gyydin

Neovim is driving me crazy but I can't stop

I never thought anyone could become addicted to configuring a terminal-based text editor. But here we are. If you have an addictive personality, I suggest you read this post with caution and let it serve as a warning sign, not as encouragement. This is about my first few weeks of trying to configure Neovim, and the emotional damage it has caused me.

I. Background

I've been using VS Code now for many years and I have been very happy with it. It's a lot faster and lighter than IDEs like Visual Studio or PyCharm, it has extensions for every single little thing you can think of and it just lets me do my work fast and well.

I recently started watching ThePrimeagens Youtube videos and found them extremely entertaining. Prime is like a less cheesy version of Dr Disrespect, and instead of playing Fortnite with kids, Prime makes videos related to coding and serious stuff but with an equally high entertainment value and great memes only geeks understand.

Neovim is a recurring subject in his videos and Prime praises it to the moon. He even has a tutorial series about it. I've heard about Neovim before and understood that it's a terminal-based text editor that you can configure with different plugins and keyboard shortcuts, but I've always put it off as something that some geeks use to help cure their inferiority complex by trying to deliberately make their colleagues uncomfortable when they share their screen at work. At first, I thought that the reason that Prime uses Neovim is just some gimmick to get more viewers, because watching someone code in Neovim certainly looks cool, but I doubted that one can actually be more productive in Neovim than in VS Code. When it comes to tools and technology in general, I've always had a quite pragmatic mindset and I have always been fine with using whatever gets the job done the quickest. Because getting the job done is why we're using an editor in the first place.

However, after watching and reading more about Neovim and becoming more and more brainwashed by the "Neovim GOOD - VS Code BAD" -memes, I decided to try tinkering a little with Neovim. After all, what harm can it do? I also somehow got convinced that Neovim will help you do the job faster if you learn it well. This was enough for me to at least give it a try. If I don't like it, I'll just go back to VS Code.

II. Getting started

My first step was to Google how to get started with Neovim and I found a post in r/neovim where someone complained about not being able to configure NvChad properly. A fellow redditor suggested that NvChad can be too difficult for a beginner and suggested they should use AstroNvim instead. NvChad and AstroNvim are Neovim "distros" that come preconfigured. Using a distro sounded great, so based on that information from a random stranger, I figured that AstroNvim is a good place to start to get a functioning config up and ready without having to spend too much time on configuration.

After tinkering with AstroNvim a little and doing things like switching color themes, trying to figure out which colors will make me write the best code and trying to understand how the hell you even save a file, I started getting a little bit more comfortable with it and starting to realize the idea why mouseless development is something to strive for. However, producing some actual code was out of the question, as there were always some functionality that I missed or a hotkey that I did not know. If I couldn't find what the hotkey (I guess calling them hotkeys is wrong but that's what they are) was, I asked Google how to set the hotkey, but there seemed to be different ways and just understanding in which file to put the keybinding snippet was hard. The general first impression was that Neovim is clunky and difficult, even though I used a preconfigured distro, but I put it down to a skill issue and I was not ready to give up and go back to VS Code yet.

III. Frustration Amasses

After spending some hours trying (and failing) to install the things I was missing, like linters etc, I blamed it on AstroNvim not being well documented and decided to give NvChad a try. Maybe taking advice from random strangers on the internet does not always pay off. NvChad seemed to have better documentation with a CheatSheet for the hotkeys and all, so it seemed great. And I also found a video on Youtube for setting up NvChad for Python, which was a great bonus since I am primarily doing Python coding. However, the person in the youtube video was using null-ls which is now archived, and I didn't have a clue what to replace it with so I helplessly fumbled around trying to find a solution how to get linting and autoformatting without having to use an archived repository. I found some random solutions like prettier and others, but there were 7 different ways to install them and I could not get anyone of them to work, so I failed miserably at that too. I felt helpless and I had so many questions that Google did not seem to be able to answer. I did not have a clue how Neovim really works. What is Lazy? What is Mason? What's the difference between the two? And what the hell is an LSP anyway?

IV. Accepting defeat

After being in a dark place for a while, I went back to VS Code where I installed the vim plugin and configured the motions I wanted. I felt like by using the vim plugin, I had at least taken a tiny step away from the soy boys and towards the Neovim-chads. I set up my custom keybindings for VS Code and tried to force myself to skip the mouse as much as possible. I found that I could get some actual coding done, and I became better at using the vim motions as well. My body and brain, who have been so used to using the mouse for such a long time were slowly getting accustomed to using primarily the keyboard to navigate VS Code. I felt relief. I was finally physically and mentally able to produce code and I had this shiny new vim plugin in VS Code that was at least a little bit cool and would give me the same alleged productivity benefits over time.

However, there was still a bitter taste in my mouth after having tasted the mythical Neovim world and being close to achieving coding Nirvana. All I could see and feel when I closed my eyes at night was that sweet catppuccin theme and I was navigating my dreams with vim motions. I dreamed about the feeling of invincibility I would get from doing all my coding in the terminal without having to use a clunky Electron app that doesn't even use treesitter. I felt like something was missing. A part of me had awakened that could not become silenced by a simple VS Code extension. I needed more.

V. Going full VIM

I had planned to do some coding this weekend as I have been trying to learn some new web development concepts now for a while. I had nothing extra planned and a lot of hours to spend on improving skills that would perhaps advance my career. I don't do much real coding in my day job so I enjoy working on fun projects in my spare time and learning new things.

On Friday evening I opened my terminal and created the folder structure for my new web development project. When I was about to press enter after typing code . to open my true friend VS Code, something snapped in my head. I stared at the command for about ten seconds, deleted it, and typed nvim . and pressed enter. In what seemed like less than a millisecond, that beautiful catppuccin theme popped up that I had configured some weeks ago and I knew there was no turning back. VS Code can suck it.

Next, I went to Google to find how to configure Neovim for Typescript since I would be learning that as part of my web development project. I could not find any meaningful answers that were applicable to my config, so I stumbled in the dark for some time trying different things with Mason. I read somewhere that typescript-language-server is what you need so I tried installing that, and Mason said it got installed, but when trying to apply LSP formatting while my .ts file was open it only said something in the style of "no LSP found".

The frustration was rising again and after some failed attempts at debugging this and trying to understand what the different config files were even doing, I decided I need to learn this from scratch. I had now idea what the code I had gotten from the youtube video was doing and I was obviously lacking som fundamental knowledge about vim to be able to fix my problems. I found a good tutorial on the lsp-zero repository that actually explained some key concepts and I managed to quite quickly get a working config that looked good. However, all the code was in my init.lua file so that felt a little bit off-putting and homemade. I found another tutorial to configure Neovim from scratch and I have now spent 6 hours going through the first 18 minutes of the video. I've deleted my ~/.config/nvim twice and started over. My brain is trying to tell me that it's stupid to waste this much time on getting an editor configured and although I feel sick I can't physically quit. I've come too far now to turn back.

VI. Conclusion

I'm unsure if this falls under stupidity or insanity. My goal right now is to get a working config that I'm satisfied with during this weekend and if I get some real coding done as well then that is a big plus. Right now i regret I did not stay in VS Code, but I have spent too many hours now to go back.

If there are others out there that are failing at Neovim at this very moment, hit me up on gyydin.hackernews@gmail.com and share your story and possible resources you used to stop failing at Neovim. If I ever get this configured, I might make a post about how to do it properly.