Introduction
Neovim was born as an evolution of the classic Vim, designed to offer a more modern and flexible editing experience in Linux environments. Its architecture is designed to be extensible, facilitating the integration of plugins written in Lua and improving performance over its predecessor.
History and philosophy
The Neovim project was launched in 2014 with the goal of addressing some of Vim’s technical debt and opening the door to new functionalities. The developers wanted to separate the editor’s logic from the user interface, allowing graphical interfaces, terminals, and embedded components to communicate via an API based on msgpack.
Main advantages over Vim
- Better support for graphical and embedded interfaces.
- Plugin API based on msgpack, more robust and documented.
- Native integration of the Lua language for configuration and plugins.
- More frequent updates and an active community driving constant improvements.
- Lower resource consumption in intensive usage scenarios.
Installation on popular Linux distributions
To install Neovim on Ubuntu or Debian:
sudo apt update
sudo apt install neovimOn Fedora:
sudo dnf install neovimOn Arch Linux:
sudo pacman -S neovimIf you prefer to compile from source to get the latest stable version, follow these steps:
git clone https://github.com/neovim/neovim.git
cd neovim
make CMAKE_BUILD_TYPE=Release
sudo make installInitial configuration
The configuration file is located at
~/.config/nvim/init.vimif you use Vimscript, or~/.config/nvim/init.luaif you prefer Lua. A basic example in Vimscript:
set number
set relativenumber
syntax on
filetype plugin indent on
set tabstop=4
set shiftwidth=4
set expandtabThe same setting in Lua is written as follows:
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.syntax = 'on'
vim.opt.filetype = 'on'
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = truePlugin management
The most popular plugin managers in Neovim are packer.nvim and lazy.nvim. Both allow installing, updating, and removing plugins with just a few commands.
Example installation of packer.nvim:
git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvimThen, in your
init.luayou can define the plugins:
require('packer').startup(function(use)
use 'wbthomason/packer.nvim' -- packer manages itself
use 'nvim-telescope/telescope.nvim'
use 'nvim-treesitter/nvim-treesitter'
use 'neovim/nvim-lspconfig'
use 'hrsh7th/nvim-cmp'
end)For lazy.nvim the process is similar, but with a syntax that loads plugins only when needed.
LSP and autocompletion
The Language Server Protocol (LSP) enables features such as autocompletion, go-to-definition, and showing documentation directly inside the editor. Neovim includes an integrated LSP client configured via
lspconfig.Example configuration for the Python language server:
require'lspconfig'.pyright.setup{}For autocompletion,
nvim-cmpis usually combined with sources likeluasnipandbuffer:
local cmp = require'cmp'
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
[''] = cmp.mapping.scroll_docs(-4),
[''] = cmp.mapping.scroll_docs(4),
[''] = cmp.mapping.complete(),
[''] = cmp.mapping.confirm({ select = true }),
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
}, {
{ name = 'buffer' }
})
})
Integration with development tools
Neovim easily adapts to workflows that include Git, build systems, and containers.
- Git: plugins like gitsigns.nvim show changes directly in the gutter.
- Make or Ninja: you can run
:makeand view errors in the location list. - Docker: via
:terminalyou can open a shell inside a container and work with mounted files. - Testing: integrate frameworks like pytest or jest using async tasks with
vim.fn.jobstart.
Theme and interface customization
Neovim's appearance is controlled via color schemes and status bars.
Popular color schemes:
- gruvbox – warm tones with balanced contrast.
- onedark – inspired by the VS Code theme.
- catppuccin – soft and modern palettes.
To apply a scheme, simply add:
colorscheme gruvboxThe status bar can be enhanced with plugins like lualine.nvim or galaxyline.nvim, displaying mode, Git branch, LSP diagnostics, and more.
Productivity: macros, registers, and shortcuts
Neovim inherits Vim's powerful modal editing model, allowing you to record macros for repetitive sequences.
Example of a simple macro:
qq0y$jPqThis macro copies the current line and pastes it below. To run it multiple times use
@qor a number followed by@q.Registers (
a-z,0-9,'"') store deleted or copied text and can be used at any time.Additionally, you can create custom mappings for quick access to frequent functions:
vim.keymap.set('n', 't', ':terminal')
vim.keymap.set('n', 'ff', require('telescope.builtin').find_files)Common problem troubleshooting
- Plugins not loading: verify that the
runtimepathincludes the directory where you installed them. - Colors appearing incorrectly in old terminals: ensure your terminal supports 24‑bit colors or use a scheme that works in 256 colors.
- LSP not starting: check that the language server is installed and accessible in your
$PATH.
Community and learning resources
Neovim has an active community on platforms like GitHub, Reddit, and Discord. Some recommended resources:
- The official wiki:
- The YouTube channel Neovim from scratch for step‑by‑step tutorials.
- The book Learn Vimscript the Hard Way adapted to Lua