Code as fast as thought: a beginner's guide to building a tailored editor with Neovim

This tutorial series aims to guide you in building an efficient, tailored editor based on Neovim to help you increase coding efficiency.

setup

Goal of this series

To code and navigate your code as fast as thought. Specifically, the goals of this series are

  1. Build a fast coding editor tailored to your specific needs
  2. Increase your coding efficiency by using your own editor

and these two goals should interest you if you are

and additionally, if you fall into any of the following categories, you will also find the content of this series interesting

Contents

  1. Pre-requisites

    Recommended software requirements and knowledge before starting the series, with solutions or short tutorials to help you fulfill them.

  2. Installation

    Install the bare-bones Neovim editor.

Coming very soon

  1. (Neo)Vim Basics

    Learn the terms and notation of (Neo)Vim, navigating the editor, modes, Vim motions, and commands.

  2. Built-in features

    Explore useful features of Neovim that are shipped right out of the box.

  3. The plugin system

    Learn why plugins is an essential part of the editor, how to install and configure plugins, the recommended plugin list, and how to install a plugin yourself.

  4. Running code

    Learn to write a short Lua script to customize how code is executed.

  5. Tips and further reading

    How to practice, further the customization to your needs, and other great sources of learning about Neovim.

How this series work

This series consists of 7 articles, with each except the last being an important step in achieving the goal: either coding efficiency, editor tailoring, or both.

Each article of the guide will consist of two parts

  1. Theory: knowledge about what will be done and how it works
  2. Hands-on: apply the theory, actually getting your hands dirty, and get closer to final goal

Occasionally, parts in an article may contain one or both of the following

  1. Mini tutorial to get you up to speed
  2. An external source if you want to go more in depth and learn more than the necessary for this series

Show me the results

Here are some Neovim features that I use on a daily basis:

Give me the code

You can find the daily driver setup for my MacBook (full config in the next section) in my GitHub dotfiles. If you're also on MacOS, they should work straight out of the box.

If you're looking for a more minimalistic setup, try the one for Raspberry Pi OS, also uploaded to my Github dotfiles.

Consider giving the repo a star if it helps you.

Configuration

Here is a brief overview of the setup used in this series:

Finding help

If you ever find yourself stuck in a specific part of an article, take it as a great opportunity to train your Google-fu.

Wait, this sounds so irresponsible

As irresponsible as it sounds, this was what I did when I learned all content in this series on my own. It will expose you to more related knowledge, making you more knowledgable in this field and will help you get better at finding answers on the internet the next time you have a question, coding related or not.

Some tips when Googling:

  • Include all useful details about your specific setup (ex. OS, editor name (nvim), plugin name, etc.)
  • Summarize the core of the problem, keep it short and include keywords only
  • Consider and explore all possible causes of the problem
  • Go down the rabbit hole (i.e., if you realize your problem is caused by another thing, Google that new thing)

Alternatively, contact me and I'll try to provide assistance.

What it takes to finish this series

If you are just skimming through this series quickly, it may take somewhere around 10 to 15 mins.

However, if you are committed to finishing this series from beginning to end, it may take 2-3 weekends or two weeks worth of evenings to complete and 1-2 months of constant usage to be fully proficient and "code as fast as thought."

Philosophy

If you are not interested in why Neovim was selected to serve as the basis of our customizations, feel free to get started right away!

Remark: do not worry if you find unfamilar terms in the discussion below. They will be explained in later articles of this article.

A little about Neovim: it is a modernized fork of the UNIX editor Vim. It has better support for modern features like LSPs (language server protocol), faster parsing engine, and more.

Here are some questions I know people will ask

  1. Q: Why Neovim and not Vim or Helix?

    A: Vim and its associated plugins are too old with few updates, meaning they are slow by current standards and often lack proper support. They have also made the very questionable decision to create a new scripting language from scratch in the recent 9.0 update when better alternatives (including lua, the language Neovim supports for configuration) are readily available. Vim is also used mostly by old men.

    On the other hand, Helix is too new (post-modern, as they've said themselves), lacking a well-defined way to install plugins, not to forget that so few Helix plugins have been written.

  2. Q: Why not VSCode?

    A: Despite being a great beginner option, it has some key problems which I have experienced first hand

    • Resource inefficient, both computing and storage. This is especially true when you start downloading plugins for specific languages
    • Little customization capacity. Sure, you can change your shortcuts and color scheme. But during my use at least, I was unable to do much else
    • Buggy. It would randomly generate strange errors that gave literally zero information on the root cause. What follows is one of two things: either hours of Googling or constantly closing and re-opening the editor hoping it would magically go away.
    • Little focus on coding. There are so many useless graphical elements that take attention away from what the software is meant to do: writing code.
  3. Q: Why not Microsoft Word?

    A: dunno