Installing Neovim
Recommended Installation (Ubuntu/Debian)
There are two main approaches to installing Neovim on Ubuntu-based systems:
Method 1: Install from Official Releases (Recommended)
For the latest stable version with all the newest features, you can build Neovim from source. This approach ensures you get the most recent updates and optimal performance.
Step 1: Clone and Build
First, clone the official repository and navigate to the project directory. To build for ARM architecture (Apple Silicon), checkout a specific version tag:
git clone https://github.com/neovim/neovim.git
cd neovim
git checkout v0.11.4 # Or any version from https://github.com/neovim/neovim/releases
Step 2: Build and Install
Neovim uses a CMake-based build system with a convenient Makefile wrapper. The build automatically detects your system architecture (ARM64 on Apple Silicon or x86_64 on Intel):
make CMAKE_BUILD_TYPE=RelWithDebInfo
sudo make install
The compilation will automatically target ARM architecture on Apple Silicon Macs (M1/M2/M3). No special flags are needed.
When building Neovim from source, the binary is installed to /usr/local/bin/nvim by default, while package manager installations typically place it in /usr/bin/nvim. If you need to ensure consistent access or want to override an existing installation, you can create a symbolic link:
sudo ln -sf /usr/local/bin/nvim /usr/bin/nvim
This creates a symbolic link that points /usr/bin/nvim to your custom-built version in /usr/local/bin/nvim, ensuring that the system uses your source-compiled version regardless of any package manager installations. On macOS, unless you have specific requirements, simply keeping the latest nvim in /usr/local/bin/ is sufficient—there's no need to create links in /usr/bin/.
Verification
After installation, verify that Neovim is properly installed and accessible:
nvim --version
which nvim
This should show your Neovim version and confirm the binary location.
Step 3: Custom Installation Path (Optional)
If you prefer to install Neovim to a specific location instead of the default system directories:
make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_INSTALL_PREFIX=/your/custom/path/
make install
Build Inspection Tips
- Use
cmake --build build --target helpto list all available build targets - Check
build/CMakeCache.txtfor resolved CMake variables - Review
build/compile_commands.jsonfor detailed compiler information
For more detailed installation instructions, visit the official Neovim releases page.
Method 2: Install via Package Manager
This is simpler but may provide an older version:
sudo apt update
sudo apt install neovimConfiguring Neovim
Setting Up the Configuration Directory
First, create the necessary configuration directory:
mkdir -p ~/.config/nvimUnderstanding Configuration Files
Neovim supports two configuration file formats:
init.vim: Traditional Vimscript format (backward compatible with Vim)init.lua: Modern Lua configuration format (recommended for new setups)
For a basic setup, you can create a minimal init.vim file and save it as ~/.config/nvim/init.vim. This allows you to use the same settings you'd use in a traditional .vimrc file.
Plugin Management and Modern Configuration
Using a Plugin Manager
To unlock Neovim's full potential, you'll want to use a plugin manager. Popular options include vim-plug, packer.nvim, and lazy.nvim.
Setting up vim-plug
- Install vim-plug:
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
- Add plugins to your configuration file. Here's a basic example:
call plug#begin('~/.local/share/nvim/plugged')
Plug 'tpope/vim-commentary'
Plug 'junegunn/fzf'
call plug#end()
- Open Neovim and run
:PlugInstallto install the plugins.
The Quick Start Approach: Pre-configured Distributions
If you want to skip manual configuration and jump straight into a feature-rich IDE experience, consider using a pre-configured Neovim distribution:
LazyVim (Recommended)
LazyVim provides a modern, Lua-based configuration out of the box:
git clone https://github.com/LazyVim/starter ~/.config/nvim
rm -rf ~/.config/nvim/.git
This gives you a fully-featured IDE setup with LSP support, file explorers, fuzzy finding, and much more.
Important Note: When you first launch LazyVim, it will automatically update and install plugins. If you encounter various errors during this process, they are often caused by an outdated Neovim version. To resolve this, ensure you're running the latest version of Neovim by using the manual installation method described in Step 1 (cloning from GitHub). Package managers like Homebrew or APT typically provide older versions that may not be compatible with modern plugin configurations.
Alternatives: Other popular distributions include NvChad and AstroNvim, all of which are excellent choices for research and programming workflows.
Essential Keybindings and Features
Once you've configured Neovim with plugins, you can customize keybindings to suit your workflow. Here are some common mappings found in modern configurations:
jk: Quick escape from insert modeSpace + e: Toggle file explorerCtrl + h/j/k/l: Navigate between split windows:Mason: Manage LSP servers and auto-completion plugins
These keybindings significantly improve your efficiency and make Neovim feel like a modern IDE while retaining its powerful modal editing capabilities.
Conclusion
With Neovim properly configured, you have a lightning-fast, highly customizable development environment that can rival any modern IDE. Whether you choose to build your configuration from scratch or use a pre-configured distribution, Neovim's extensibility ensures you can tailor it to your exact needs.