Quick Reference

Cheatsheets

Practical command references for Linux, networking, servers, containers, databases, and more.

Cheatsheet#nvim-cheatsheet

Neovim (Nvim) Cheatsheet

Neovim (nvim) is a fork of Vim aimed at improving extensibility and maintainability. It supports Lua for configuration and has built-in LSP (Language Server Protocol) support.

Installation

# Debian/Ubuntu
sudo apt install neovim
 
# Arch Linux
sudo pacman -S neovim
 
# macOS
brew install neovim

Basic Usage

The commands and keybindings in Neovim are almost identical to Vim. See the Vim Cheatsheet for basic navigation, editing, and saving commands.

nvim filename.txt

Configuration (~/.config/nvim/init.lua)

While Neovim supports init.vim (standard Vimscript), the modern approach is using Lua (init.lua).

-- ~/.config/nvim/init.lua
 
-- General Settings
vim.opt.number = true           -- Show line numbers
vim.opt.relativenumber = true   -- Show relative line numbers
vim.opt.tabstop = 4             -- 4 spaces per tab
vim.opt.shiftwidth = 4
vim.opt.expandtab = true        -- Use spaces instead of tabs
vim.opt.smartindent = true
vim.opt.wrap = false            -- Disable line wrap
 
-- Set leader key to Space
vim.g.mapleader = " "
 
-- Keymaps
-- Quickly save using <Space> + w
vim.keymap.set('n', '<leader>w', ':w<CR>', { noremap = true, silent = true })
 
-- Quickly quit using <Space> + q
vim.keymap.set('n', '<leader>q', ':q<CR>', { noremap = true, silent = true })

To unlock Neovim's true potential, you should use a plugin manager.

  • lazy.nvim (Currently the most popular and fastest)
  • packer.nvim (Older, but still widely used)
  • vim-plug (Classic, works for both Vim and Neovim)

If you don't want to build a configuration from scratch, you can use pre-configured setups: