4 min read

Why should you as a developer use NeoVim

Why should you as a developer use NeoVim

There's always a debate about which code editor is the best. Instead of adding to that debate, I want to share why I switched from using VS Code to NeoVim. Three years ago, I found NeoVim and was impressed by how fast and customizable it was.

I had to restart my terminal just to quit the darn thing.

At that time, I had an old 13-inch MacBook Air. VS Code felt slow and took way too much valuable space with those thick borders on my screen. My coding experience was horrible, It used to run slow and I started to hate programming. Later, I got into kernel programming and saw a video of someone coding efficiently on simple hardware with NeoVim(It was just a phase, I still could not figure out how that magic works). That got me interested.

This blog is by Harsh, a full-stack developer, who loves sci-fi and drinking black coffee. If you like this post, try KushoAI today, and start shipping bug-free code faster!

Why Learning Your Tools Matters

Switching text editors isn't just about your system performance or screen space. As a developer, you spend most of your time writing and reviewing code. Your text editor should be quick, customizable, it must fit your workflow. In essence, you should enjoy your time writing code.

NeoVim uses Lua, a literal programming language, to let you tweak it as you like. It starts up fast and you can make it do exactly what you need. Unlike JSON for customization, you can do soo much more to make it run the way you like.

Your tools should adapt to you, not the other way around.

Knowing your tools well can make you work faster and solve problems better. Understanding how text editors work, what an LSP is, or what does general-purpose parser like trisitter do (general knowledge for neovimmer), can prove helpful insights for tricky problems.

NeoVim Can Do Advanced Stuff

Here's a task: convert a list of color names and values into a JavaScript dictionary.

Original Color List:

White   #FFFFFF  
Silver  #C0C0C0  
Gray    #808080  
Black   #000000  
Red     #FF0000  
Maroon  #800000  
Yellow  #FFFF00  
Olive   #808000  
Lime    #00FF00  
Green   #008000  
Aqua    #00FFFF  
Teal    #008080  
Blue    #0000FF  
Navy    #000080  
Purple  #800080  
Fuchsia #FF00FF  

Desired JavaScript Dictionary:

const colors = {
    "White": "#FFFFFF",
    "Silver": "#C0C0C0",
    "Gray": "#808080",
    "Black": "#000000",
    "Red": "#FF0000",
    "Maroon": "#800000",
    "Yellow": "#FFFF00",
    "Olive": "#808000",
    "Lime": "#00FF00",
    "Green": "#008000",
    "Aqua": "#00FFFF",
    "Teal": "#008080",
    "Blue": "#0000FF",
    "Navy": "#000080",
    "Purple": "#800080",
    "Fuchsia": "#FF00FF"
};

In most editors, you'd format each color one by one. In NeoVim, you can do it in a few keystrokes, showing off its powerful editing abilities.

0:00
/0:41

```I'm still a noob but you can clearly see the potential here.```

How to Get Good at NeoVim

Here’s a list of steps to get good at NeoVim, ordered by how tough they are:

Step 1: Learn Vim Motion

Vim motions can make your editing faster. Install the Vim Plugin in VS Code and check out this video series. Practice daily. If it’s too much, use INSERT mode for a bit, but keep learning.

Step 2: Learn Lua

NeoVim uses Lua for custom setups. It's more flexible than JSON. Go through the Lua documentation to get the basics.

Step 3: Learn How Lua Works with NeoVim

Get to know NeoVim’s settings and functions with this guide, which covers the essentials for your configs.

Step 4: Make Your Configuration Files

Once you’ve got the basics, move on to advanced stuff like LSPs and parsers (like Tree-sitter) with this video. Watch it a few times, explore related topics, and start building your setup.

Get Comfortable with the Terminal

NeoVim runs in the terminal, and spending time there introduces you to a world of command-line tools that can make your workflow more efficient. The terminal isn’t just for NeoVim; it’s a powerful environment on its own.

Why the Terminal is Great

  • Versatility: Combine tools in countless ways to streamline tasks.
  • Customization: Tailor tools and scripts to your specific needs.

Learning the Basics

Start with commands like:

  • grep: Search text.
  • curl: Transfer data.
  • cat: View file contents.
  • | (Pipe): Chain commands.

Beyond Basics

Since diving into NeoVim, I've embraced tools like tmux for managing terminal sessions and tmux-sessionx for handling multiple projects. For example, to preview Markdown files:

fswatch -o neovim.md | while read change; do
    clear
    glow neovim.md
done

This script uses fswatch to detect file changes and uses glow to render them, making real-time previewing easy.

The Power of Bash

A little bash scripting can go a long way. Simple scripts or aliases can automate repetitive tasks, making you more productive.

This version adds details while staying focused and concise, emphasizing the terminal's utility and practical examples.

Be Flexible

Don’t be too rigid. While learning NeoVim, it’s okay to use other editors as a backup. Use the tools that best meet your needs. For example, I still use VS Code’s Thunder Client for REST requests even though NeoVim has plugins for that.

Remember: Tools should make your life easier. Use whatever works best for you. At the same time, Stalation is the death of a new programmer. Keep an open mind to try new things, and don't be hesitant to try out difficult thing.

Why Stick with It?

Why learn NeoVim if VS Code works fine? While VS Code is great, learning NeoVim can make you more efficient and help you understand your tools better. Taking on these challenges can lead to growth and new skills, which can be very rewarding.

At KushoAI, we're building an AI agent that tests your APIs for you. Bring in API information in any format and watch KushoAI turn it into fully functional and exhaustive test suites in minutes.