We get neovim installed on the Mac and lay the foundation for a modern config.

What You’ll End Up With

A clean base install of neovim on macOS and, optionally, a ready-made plugin distribution as a launchpad for a real config.

The learning curve for vim and neovim is steep at first, that’s never changed. Once you’re in, you don’t want to leave.

A Brief History of vi, vim and neovim

If you’ve worked with vi or vim, you’ll like neovim.

Back in the 1960s the Unix world had ed, a line-oriented editor. You only saw one line at a time, never the whole text. Later came ex, an extended ed, still line-oriented.

In the mid-1970s Bill Joy had enough and built a visual variant of ex. We know it as vi. Finally screen-oriented. In the late 1980s Bram Moolenaar turned that into VIM, vi improved.

The development structure is comparable to Linux. Bram decides what gets in, much like Linus does for Linux. For many people that pace is too slow.

That’s why neovim came along in 2014. Initially an extended vim with community-driven development. Today neovim is well ahead. Lua as the native config language, a built-in LSP client, Tree-sitter, asynchronous plugins. If you stay on vim, you’re fine. If you want more and you’re willing to embrace a modern plugin ecosystem, you end up on neovim.

Prerequisites

A current macOS is enough. I install everything through Homebrew, the de-facto standard on the Mac. If you don’t have Homebrew yet, take care of that first.

Installation

In the terminal:

brew install neovim

That’s it for now. Start the editor with nvim.

First Launch

On the first run neovim looks fresh and tidy. A few defaults that used to require explicit setup in every vim config are already on in neovim.

Neovim right after the first launch

This is what neovim looks like after the first launch.

If you’ve never used a vi-style editor: you exit with :q! (quit without saving). If you can’t enter that, hit ESC first and type it then.

Alias vi and vim to nvim

vim ships with macOS, so you have both editors on your machine. It’s handy to launch neovim through vi and vim as well. In ~/.zshrc:

echo "alias vi='nvim'" >> ~/.zshrc
echo "alias vim='nvim'" >> ~/.zshrc
source ~/.zshrc

Empty Config

Modern neovim is configured in Lua, not in VimScript. The config lives at ~/.config/nvim/init.lua:

mkdir -p ~/.config/nvim
touch ~/.config/nvim/init.lua

Heads-up: if you continue with LazyVim (next section), you can skip this step. LazyVim brings its own structure.

Quick Start with LazyVim

Building an init.lua from scratch is possible, but for most people it’s a long road. If you want a real editor environment with LSP, autocomplete, Tree-sitter, Telescope, a file explorer and sane keybindings without spending a weekend on it, LazyVim is a great choice. LazyVim is a pre-built distribution by Folke Lemaitre, based on the plugin manager lazy.nvim.

The short version of installing it:

# Tools LazyVim recommends
brew install ripgrep fd lazygit

# Back up any existing neovim data
mv ~/.config/nvim{,.bak} 2>/dev/null
mv ~/.local/share/nvim{,.bak} 2>/dev/null
mv ~/.local/state/nvim{,.bak} 2>/dev/null
mv ~/.cache/nvim{,.bak} 2>/dev/null

# Clone the starter repo
git clone https://github.com/LazyVim/starter ~/.config/nvim

# Drop the starter's git history so you can start your own
rm -rf ~/.config/nvim/.git

# Off you go
nvim

On first launch LazyVim pulls all plugins itself. Give it a few seconds. After that you can run :LazyExtras to enable additional modules, e.g. for specific languages or tools. The LazyVim docs cover everything else.

I recommend this route to anyone who doesn’t want to build everything by hand from day one.

Basics

The basics of operating vim and neovim are in a separate post. Modes, navigation, search, editing, the things you actually need every day.