How to Install and Use Neovim on Ubuntu
Neovim is a modern, lightweight text editor built from the Vim tradition. It runs in a terminal, starts quickly, handles large files well, and can be extended with plugins for programming, Markdown, configuration files, and everyday writing. On Ubuntu, it is available through standard software repositories, so you can begin without downloading an unfamiliar installer.
The editor is keyboard-driven, which makes it different from graphical applications such as GNOME Text Editor, Kate, or Visual Studio Code. Instead of selecting every action with a mouse, you use commands to move around, insert text, save files, search, and open several files at once. The learning curve is real, although a small set of commands covers most daily tasks.
Neovim suits Ubuntu users who work across different machines, including an older laptop, a desktop connected through an NBN service, or a small Raspberry Pi used for home projects. It is also useful for people who edit shell scripts, SSH configuration, Python files, website content, or notes on a remote server.
The examples below use Ubuntu’s Terminal and standard command-line tools. The commands work well on current long-term support releases, including Ubuntu 22.04 and Ubuntu 24.04. Package versions can differ between releases, so a newer Neovim feature may require an installation method beyond the default Ubuntu repository.
Install Neovim from Ubuntu’s repositories
Open Terminal with Ctrl + Alt + T, then refresh the package information:
sudo apt update
Install Neovim with:
sudo apt install neovim
Ubuntu will resolve the required dependencies and ask for your password. Linux does not show characters while you type a password in Terminal; enter it normally and press Enter. When installation finishes, check the version:
nvim --version
The first line displays the installed release. The Ubuntu repository is the simplest option because it receives updates through the same system tools as the rest of your software. It is a sensible choice for a work computer in Sydney, Brisbane, or Perth where stability matters more than having the newest editor features.
Some Ubuntu releases provide an older Neovim package. If you need a recent version for a plugin or language server, consider the official AppImage or a trusted third-party package source after checking its maintenance status. Snap is another option:
sudo snap install nvim --classic
Avoid installing several versions at once unless you know which executable your shell is using. Run which nvim to see the location, and use snap list nvim or apt policy neovim to identify the package source. For most people, the regular apt package is the least troublesome starting point.
Learn the basic editing workflow
Start Neovim by opening a file:
nvim notes.txt
If the file does not exist, Neovim creates it when you save. You will initially be in Normal mode, where keys perform commands rather than insert letters. Press i to enter Insert mode, type a few lines, and press Esc to return to Normal mode.
The essential commands are straightforward once they become muscle memory. In Normal mode, use h, j, k, and l to move left, down, up, and right. You can also use the arrow keys. Press :w and Enter to save, :q and Enter to quit, or combine them as :wq to save and quit. To leave without saving, use :q!.
A practical first session looks like this:
nvim todo.txt
i
Buy groceries
Review the shell script
Esc
:w
:q
Neovim has separate commands for common operations. Press dd to delete a line, yy to copy it, and p to paste it below the cursor. Use u to undo and Ctrl + r to redo. Search with /word, press Enter, and use n to move to the next match. These commands work in configuration files just as they do in prose.
You can open a file at a particular line from the shell:
nvim +25 script.sh
Inside Neovim, :edit filename opens another file, while :split filename creates a horizontal split. Use :vsplit filename for a vertical split. Ctrl + w followed by an arrow key moves between splits. This is useful when comparing a README with a script or checking an Ubuntu service file while editing its replacement.
Create a simple Neovim configuration
Neovim stores its user configuration in a different location from traditional Vim. On Ubuntu, the main configuration file is usually:
~/.config/nvim/init.lua
Create the directory and file with:
mkdir -p ~/.config/nvim
nvim ~/.config/nvim/init.lua
For a beginner-friendly configuration, press i and add:
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.expandtab = true
vim.opt.shiftwidth = 4
vim.opt.tabstop = 4
vim.opt.smartindent = true
vim.opt.termguicolors = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
Save with Esc, then :wq. Line numbers make it easier to discuss errors, while relative numbers help with commands such as 5j and 3k. The indentation settings make the Tab key insert spaces, which is generally convenient for Python, YAML, and shell scripts. If a project requires tabs, its local rules should take priority.
You can add a useful shortcut for saving:
vim.keymap.set("n", "<C-s>", "<cmd>write<cr>", { desc = "Save file" })
This maps Ctrl + S in Normal mode to the save command. Neovim already reloads init.lua when it starts, so close and reopen the editor to test your changes. If an error appears, launch Neovim without your configuration using:
nvim --clean
That clean mode helps distinguish a configuration problem from an issue in the editor itself. Keep the file simple at first. A short configuration that you understand is more valuable than copying a large “starter config” from a random repository.
Add plugins and language support carefully
Plugins add features such as a file browser, fuzzy search, automatic completion, syntax highlighting, and Git integration. Neovim does not include a full plugin manager by default, so many users install lazy.nvim, a popular and actively maintained manager.
First, make sure Git is installed:
sudo apt install git
Then create a basic lazy.nvim bootstrap in init.lua:
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
},
})
Restart Neovim and the plugin manager will download the Treesitter plugin. Treesitter improves syntax highlighting and code awareness, although language parsers may need additional configuration. You can inspect installed plugins with :Lazy.
Language Server Protocol support provides diagnostics, code navigation, completion, and other programming features. Neovim needs both a client configuration and the relevant language server installed. For example, Ubuntu’s Python tools can be installed with:
sudo apt install python3-pyright
For shell scripts, install ShellCheck:
sudo apt install shellcheck
A plugin such as nvim-lspconfig can connect Neovim to these tools, but setup varies between Neovim releases. Read the plugin’s documentation and check its required minimum version before copying configuration. This is especially important when an Ubuntu LTS package contains an older Neovim release.
Use plugins selectively. A writer editing Markdown on an Adelaide laptop may need spell checking, a file finder, and a pleasant colour scheme, while a developer working on a Go project may need formatting and language-server support. Every plugin adds maintenance, so install one feature at a time and learn its commands before adding another.
Make Neovim comfortable for everyday Ubuntu use
Neovim works particularly well with Ubuntu’s command-line utilities. Open a project directory with cd, inspect files using ls, and launch the editor with a relative path:
cd ~/Projects/website
nvim README.md
You can edit system files, but use care with sudo. A safer pattern is to open a protected file with the required permissions only when necessary:
sudoedit /etc/hosts
Ubuntu selects an appropriate package mirror automatically, though downloads can feel different on a slower regional connection or a busy NBN evening. If sudo apt update reports mirror errors, wait briefly, check your network, or inspect the software sources in “Software & Updates” before changing repositories manually. Do not paste commands from an unverified forum simply because they promise a newer package.
Neovim is also convenient over SSH. On a small home server, a university lab machine, or a cloud instance hosted outside Australia, you can connect with:
ssh user@example.com
nvim /path/to/file
The editor uses the remote machine’s files and tools, so language servers and formatters must be installed there. Terminal colour support can vary depending on the SSH client and terminal emulator. If the display looks wrong, try :set termguicolors?, check the TERM environment variable, and temporarily remove vim.opt.termguicolors = true.
For a smoother daily workflow, keep projects organised and make backups through Git or another backup system. Neovim can recover unsaved work after a crash, but recovery files are not a substitute for version control. When editing shell scripts, run them in a separate Terminal window and use shellcheck where appropriate. For Markdown, preview the rendered result in a browser or a dedicated preview tool rather than relying only on editor highlighting.
The best way to learn is to use Neovim for small, low-risk tasks. Edit a personal notes file, change a Git commit message, or update a copy of a configuration file before attempting changes to a production server. The commands become natural through repetition, and you can add custom mappings as your workflow develops.
Neovim does not need to replace every graphical editor. Ubuntu users can keep GNOME Text Editor for quick one-off changes and use Neovim when they want speed, precise keyboard control, multiple files, or a highly customised environment. That balance works well on a home desktop in Melbourne, a remote-work laptop in Canberra, or a low-powered machine used while travelling through regional New South Wales.
Create a test file now with nvim ~/neovim-practice.txt, enter three lines, save it with :w, search one word using /, and close the editor with :q.