How To Install Neovim on Manjaro
Neovim has become a popular choice for developers and system administrators looking for a powerful, extensible text editor on Linux systems. If you’re running Manjaro Linux and want to enhance your text editing capabilities, installing Neovim is an excellent choice. This comprehensive guide will walk you through various installation methods, configuration options, and troubleshooting tips to help you set up a fully functional Neovim environment on your Manjaro system.
What is Neovim?
Neovim is a hyperextensible, Vim-based text editor that aims to improve upon the traditional Vim experience by offering modern features while maintaining compatibility with Vim’s ecosystem. Developed as a fork of Vim, Neovim addresses some of the limitations of its predecessor while introducing new capabilities that make it more suitable for modern development workflows.
Unlike traditional Vim, Neovim supports asynchronous operations, which means plugins can run in the background without freezing the editor. This feature significantly improves performance when working with large files or running code analysis tools. Additionally, Neovim offers:
- A built-in terminal emulator allowing seamless command execution
- Extensive Lua integration for configuration and plugin development
- Enhanced UI customization options
- Native LSP (Language Server Protocol) support
- Cross-platform compatibility across Linux, macOS, and Windows
These improvements make Neovim particularly suitable for developers working on Manjaro Linux who need a lightweight yet powerful text editor for coding, system administration, or general text editing tasks.
Why Use Neovim on Manjaro
Manjaro Linux, being an Arch-based distribution, offers an ideal environment for Neovim due to several key advantages. The rolling release nature of Manjaro ensures you can always access the latest version of Neovim with all its newest features and improvements.
Neovim integrates seamlessly with Manjaro’s package management system, making installation and updates straightforward. The Arch User Repository (AUR) provides additional installation options, allowing you to choose between stable releases and development versions based on your preferences.
Performance is another compelling reason to use Neovim on Manjaro. The editor starts almost instantly and consumes minimal system resources, making it suitable even for older hardware or resource-constrained environments. This lightweight nature doesn’t compromise functionality, as Neovim’s plugin ecosystem allows you to extend its capabilities as needed.
For developers working in Manjaro’s terminal environment, Neovim offers a superior editing experience with features like:
- Efficient text navigation and manipulation
- Customizable key mappings
- Code completion and syntax highlighting
- Integration with development tools and version control systems
- Split windows for viewing multiple files simultaneously
Prerequisites
Before installing Neovim on your Manjaro system, there are a few prerequisites to check. This ensures a smooth installation process and prepares your system for the additional components you might need later.
First, make sure your Manjaro system is up-to-date by running:
sudo pacman -Syu
If you have an existing Vim or Neovim installation that you want to replace, it’s a good idea to check for it:
which vim
which nvim
If you find existing installations and want to start fresh, you can remove them:
sudo pacman -R vim neovim
Additionally, it’s wise to back up any existing configurations in case you want to reference them later:
cp -r ~/.vim ~/.vim_backup
cp -r ~/.config/nvim ~/.config/nvim_backup
While not strictly required for installation, having git available will be useful for installing plugins and additional components:
sudo pacman -S git
Installation Methods
There are several ways to install Neovim on Manjaro, each with its own advantages. Choose the method that best suits your needs based on your preference for stability, update frequency, or specific features.
Installing via Pacman (Official Repositories)
Using Manjaro’s official package manager, pacman, is the most straightforward way to install Neovim. This method provides a stable version that has been tested with Manjaro and receives regular updates.
To install Neovim using pacman, open a terminal and enter:
sudo pacman -Sy
sudo pacman -S neovim
This command updates the package database and installs Neovim with all its dependencies. You might be prompted to choose optional dependencies during installation, such as:
- python-neovim (python-pynvim): For Python plugin support
- xsel or xclip: For clipboard support on X11
- wl-clipboard: For clipboard support on Wayland
It’s recommended to select at least the Python support option, as many plugins rely on it.
After installation, verify that Neovim is correctly installed by running:
nvim --version
This should display the installed Neovim version and compilation information. You can now launch Neovim by simply typing:
nvim
The advantage of this installation method is its simplicity and integration with Manjaro’s package management system, allowing easy updates through regular system maintenance.
Installing via AUR
The Arch User Repository (AUR) offers alternative versions of Neovim, including development versions and nightly builds. This is useful if you want to access the latest features before they reach the official repositories.
To install Neovim from the AUR, you’ll need an AUR helper like yay or paru. If you don’t have one installed:
sudo pacman -S yay
With yay installed, you can choose from several Neovim packages:
For the latest stable version with additional features:
yay -S neovim-git
For nightly builds with the newest (potentially unstable) features:
yay -S neovim-nightly-bin
For specific Neovim variants with additional components:
yay -S neovim-qt # Qt GUI version
Similar to the pacman installation, you’ll be prompted to select optional dependencies. The AUR versions might include additional options specific to those builds.
Keep in mind that AUR packages are maintained by community members, so there might be occasional delays in updates or compatibility issues. However, they often provide the latest features and improvements before they reach the official repositories.
Installing via Snap
Snap is a universal package system that works across many Linux distributions. Installing Neovim via Snap provides a containerized version that includes most dependencies.
First, ensure that Snap is installed on your Manjaro system:
sudo pacman -S snapd
sudo systemctl enable --now snapd.socket
You may need to log out and back in, or reboot your system for the snap path to be updated. Then, install Neovim:
sudo snap install nvim --classic
The --classic
flag is necessary to give Neovim the permissions it needs to access files outside its container.
Once installed, you can launch Neovim with:
snap run nvim
Or simply:
nvim
If the command is in your PATH.
The advantage of Snap installation is that it’s self-contained and automatically updated. However, it might have some limitations in file system access and integration with system tools.
Installing via Flatpak
Flatpak is another universal package system that offers sandboxed applications. Installing Neovim via Flatpak is similar to using Snap but with a different configuration approach.
First, set up Flatpak on your Manjaro system:
sudo pacman -S flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Then, install Neovim:
flatpak install flathub io.neovim.nvim
To run Neovim installed via Flatpak:
flatpak run io.neovim.nvim
Note that Flatpak applications have a different configuration path. Instead of ~/.config/nvim
, Flatpak’s Neovim looks for configuration in ~/.var/app/io.neovim.nvim/config/nvim
.
You can add Flatpak’s binary directory to your PATH for easier access:
echo 'export PATH="$PATH:~/.local/share/flatpak/exports/bin"' >> ~/.bashrc
source ~/.bashrc
After which you can run it with:
io.neovim.nvim
Building from Source
For the most control over your Neovim installation, building from source is the way to go. This method allows you to customize compilation options and have the absolute latest version.
First, install the necessary build dependencies:
sudo pacman -S base-devel cmake unzip ninja curl
Clone the Neovim repository:
git clone https://github.com/neovim/neovim
cd neovim
Compile with the release build type for optimal performance:
make CMAKE_BUILD_TYPE=Release
Install system-wide (requires sudo):
sudo make install
Or install to a custom location to avoid conflicts:
make CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$HOME/neovim"
make install
export PATH="$HOME/neovim/bin:$PATH"
echo 'export PATH="$PATH:$HOME/neovim/bin"' >> ~/.bashrc
Building from source gives you the latest features and bug fixes, but requires more manual maintenance for updates. To update a source installation, you need to pull changes and rebuild:
cd neovim
git pull
make clean
make CMAKE_BUILD_TYPE=Release
sudo make install
Basic Configuration Setup
After installing Neovim, the next step is setting up a basic configuration. Neovim uses a different configuration directory than Vim, located at ~/.config/nvim/
.
First, create the configuration directory if it doesn’t exist:
mkdir -p ~/.config/nvim
Next, create the main configuration file. Neovim supports both traditional Vimscript in init.vim
and Lua in init.lua
. Let’s start with a basic init.vim
:
nvim ~/.config/nvim/init.vim
Add some essential configuration options:
" Basic Settings
set number " Show line numbers
set relativenumber " Show relative line numbers
set expandtab " Use spaces instead of tabs
set tabstop=4 " Set tab width to 4 spaces
set shiftwidth=4 " Set indent width to 4 spaces
set autoindent " Auto indent new lines
set smartindent " Smart indenting
set showmatch " Highlight matching brackets
set ignorecase " Ignore case in search
set smartcase " But case-sensitive if expression contains capitals
set hlsearch " Highlight search results
set incsearch " Incremental search
set clipboard+=unnamedplus " Use system clipboard
" Visual enhancements
set termguicolors " True color support
set cursorline " Highlight current line
syntax enable " Enable syntax highlighting
" Performance settings
set updatetime=300 " Faster refresh
set lazyredraw " Don't redraw screen during macros
For Vim users transitioning to Neovim, it’s possible to use your existing Vim configuration by adding this to init.vim
:
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc
If you prefer using Lua for configuration, create init.lua
instead:
nvim ~/.config/nvim/init.lua
With content like:
-- Basic Settings
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.expandtab = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.autoindent = true
vim.opt.smartindent = true
vim.opt.showmatch = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.hlsearch = true
vim.opt.incsearch = true
vim.opt.clipboard = "unnamedplus"
-- Visual enhancements
vim.opt.termguicolors = true
vim.opt.cursorline = true
vim.cmd('syntax enable')
-- Performance settings
vim.opt.updatetime = 300
vim.opt.lazyredraw = true
After saving your configuration, restart Neovim for the changes to take effect. You can test your configuration by opening a file:
nvim testfile.txt
Setting Up Language Providers
Neovim supports various language providers that enable integration with programming languages for plugin development and enhanced features. Setting these up is crucial for a complete Neovim experience.
Python Provider
Python is one of the most important language providers for Neovim, as many plugins depend on it:
sudo pacman -S python python-pip
pip3 install pynvim
You can also install it through pacman:
sudo pacman -S python-pynvim
Node.js Provider
Node.js support is necessary for certain language servers and JavaScript-based plugins:
sudo pacman -S nodejs npm
sudo npm install -g neovim
Alternatively, install the AUR package:
yay -S nodejs-neovim
If you prefer to manage Node.js versions, you can use Node Version Manager:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
source ~/.bashrc
nvm install --lts
npm install -g neovim
Ruby Provider
Some older plugins might require Ruby support:
sudo pacman -S ruby
gem install neovim
Or through AUR:
yay -S ruby-neovim
Add Ruby gem path to your shell configuration:
echo 'export GEM_PATH="$HOME/.local/share/gem/ruby/3.0.0/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:$HOME/.local/share/gem/ruby/3.0.0/bin"' >> ~/.bash_profile
source ~/.bash_profile
Perl Provider
For complete language support, including Perl:
sudo pacman -S cpanminus perl-local-lib
cpanm -n Neovim::Ext
Add Perl environment variables:
echo 'export PERL_MB_OPT="--install_base $HOME/perl5"' >> ~/.bash_profile
echo 'export PERL_MM_OPT="INSTALL_BASE=$HOME/perl5"' >> ~/.bash_profile
echo 'export PERL5LIB="$HOME/perl5/lib/perl5"' >> ~/.bash_profile
echo 'export PATH="$PATH:$HOME/perl5/bin"' >> ~/.bash_profile
source ~/.bash_profile
Checking Provider Status
After setting up language providers, verify that they’re working correctly:
nvim
In Neovim, run the health check command:
:checkhealth
This will show the status of all providers and suggest fixes for any issues. Make sure Python, Node.js, Ruby, and Perl providers are all marked as “OK”.
Installing Plugin Managers and Essential Plugins
Plugins extend Neovim’s functionality, and plugin managers make it easy to install and manage them. There are several options, with vim-plug and packer.nvim being among the most popular.
Setting Up vim-plug
Vim-plug is a minimalist plugin manager that’s easy to set up:
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
Edit your init.vim
to include plugin declarations:
call plug#begin('~/.local/share/nvim/plugged')
" UI Enhancements
Plug 'morhetz/gruvbox' " Color scheme
Plug 'vim-airline/vim-airline' " Status line
Plug 'vim-airline/vim-airline-themes' " Status line themes
" File Navigation
Plug 'nvim-lua/plenary.nvim' " Required dependency
Plug 'nvim-telescope/telescope.nvim' " Fuzzy finder
" LSP Support
Plug 'neovim/nvim-lspconfig' " LSP configuration
Plug 'hrsh7th/nvim-cmp' " Completion engine
Plug 'hrsh7th/cmp-nvim-lsp' " LSP completion source
" File Explorer
Plug 'nvim-tree/nvim-tree.lua' " File tree
Plug 'nvim-tree/nvim-web-devicons' " Icons for file tree
" Git Integration
Plug 'lewis6991/gitsigns.nvim' " Git signs in gutter
call plug#end()
" Plugin Configuration
colorscheme gruvbox
Install the plugins by running:
:PlugInstall
Setting Up packer.nvim
Packer is a newer plugin manager written in Lua:
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
~/.local/share/nvim/site/pack/packer/start/packer.nvim
Create a Lua file for plugin declarations:
mkdir -p ~/.config/nvim/lua
nvim ~/.config/nvim/lua/plugins.lua
Add your plugin configurations:
return require('packer').startup(function()
use 'wbthomason/packer.nvim'
-- UI Enhancements
use 'morhetz/gruvbox'
use 'vim-airline/vim-airline'
use 'vim-airline/vim-airline-themes'
-- File Navigation
use 'nvim-lua/plenary.nvim'
use 'nvim-telescope/telescope.nvim'
-- LSP Support
use 'neovim/nvim-lspconfig'
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
-- File Explorer
use {
'nvim-tree/nvim-tree.lua',
requires = 'nvim-tree/nvim-web-devicons'
}
-- Git Integration
use 'lewis6991/gitsigns.nvim'
end)
In your init.lua
, add:
require('plugins')
Install the plugins by running:
:PackerInstall
Essential Plugins for Productivity
Regardless of which plugin manager you choose, certain plugins significantly enhance Neovim’s capabilities:
- Telescope for fuzzy finding files, grep results, and more
- nvim-lspconfig for Language Server Protocol support
- nvim-treesitter for improved syntax highlighting and code navigation
- nvim-cmp for completion suggestions
- nvim-tree or NERDTree for file browsing
- gitsigns.nvim for Git integration
Configure these plugins according to your workflow needs. For example, a basic LSP configuration might look like:
-- LSP Configuration
require('lspconfig').pyright.setup{} -- Python
require('lspconfig').tsserver.setup{} -- TypeScript/JavaScript
require('lspconfig').rust_analyzer.setup{} -- Rust
Clipboard Integration and Terminal Settings
For a seamless editing experience, you’ll want to integrate Neovim with your system clipboard and optimize terminal settings.
Clipboard Support
Install xclip for X11 clipboard support:
sudo pacman -S xclip
Or wl-clipboard for Wayland:
sudo pacman -S wl-clipboard
Add clipboard configuration to your init.vim
:
set clipboard+=unnamed,unnamedplus
Or in init.lua
:
vim.opt.clipboard = "unnamed,unnamedplus"
Test clipboard integration by yanking text in Neovim and pasting it in another application.
Terminal Integration
Neovim includes a built-in terminal that you can access with:
:terminal
Customize terminal behavior in your configuration:
" Terminal settings
autocmd TermOpen * setlocal nonumber norelativenumber
autocmd TermOpen * startinsert
" Easy terminal navigation
tnoremap <C-\>
tnoremap <C-\>h
tnoremap <C-\>j
tnoremap <C-\>k
tnoremap <C-\>l
Troubleshooting Common Issues
Despite careful installation, you might encounter some issues when setting up Neovim on Manjaro. Here are solutions to common problems.
PGP Signature Errors
If you encounter signature verification errors during installation:
sudo pacman-key --refresh-keys
sudo pacman -Syyu
If that doesn’t work, try temporarily disabling signature checking (use with caution):
sudo pacman -S neovim --needed --noconfirm --disable-download-timeout
Language Provider Errors
If :checkhealth
shows issues with language providers:
Python provider errors:
pip uninstall pynvim
pip install pynvim --upgrade
Node.js provider errors:
npm uninstall -g neovim
npm install -g neovim
Ruby provider errors:
gem uninstall -aIx neovim
gem install neovim
Missing Configuration Directory
If the ~/.config/nvim
directory isn’t automatically created:
mkdir -p ~/.config/nvim
touch ~/.config/nvim/init.vim
This is normal behavior, as Neovim doesn’t create the directory by default.
Plugin Loading Issues
If plugins aren’t loading correctly:
- Check for errors:
:messages
- Verify plugin installation:
:PlugStatus
or
:PackerStatus
- Try updating plugins:
:PlugUpdate
or
:PackerUpdate
Performance Problems
If Neovim feels slow, check which plugins might be causing issues:
:profile start profile.log
:profile func *
:profile file *
" Do the slow operation
:profile pause
:noautocmd qall!
Then examine profile.log
to identify bottlenecks.
Updating Neovim
Keeping Neovim updated ensures you have the latest features and bug fixes. The update method depends on how you installed it.
Updating via Pacman
For installations from official repositories:
sudo pacman -Syu
Updating AUR Installations
For AUR installations:
yay -Sua
Or specifically:
yay -S neovim-git
Updating Snap Installations
Snap packages update automatically, but you can force an update:
sudo snap refresh nvim
Updating Flatpak Installations
Update Flatpak applications:
flatpak update
Updating Source Installations
For installations built from source:
cd neovim
git pull
make clean
make CMAKE_BUILD_TYPE=Release
sudo make install
Uninstalling Neovim
If you need to remove Neovim completely from your system, follow these steps based on your installation method.
Uninstalling via Pacman
sudo pacman -Rcns neovim
This removes Neovim and its dependencies that aren’t required by other packages.
Uninstalling AUR Installations
yay -Rcns neovim-git
Or whichever AUR package you installed.
Uninstalling Snap Installations
sudo snap remove nvim
Uninstalling Flatpak Installations
flatpak uninstall io.neovim.nvim
Removing Configuration Files
To completely remove all traces of Neovim:
rm -rf ~/.config/nvim
rm -rf ~/.local/share/nvim
rm -rf ~/.cache/nvim
Integrating Neovim with Development Workflows
Neovim truly shines when integrated into your development workflow. Here are some ways to enhance your productivity with Neovim on Manjaro.
Language-Specific Setup
Configure Neovim for specific programming languages:
Python development:
" Python specific settings
autocmd FileType python setlocal expandtab tabstop=4 shiftwidth=4
let g:python3_host_prog = '/usr/bin/python3'
Web development:
" Web development settings
autocmd FileType html,css,javascript,typescript setlocal expandtab tabstop=2 shiftwidth=2
Git Integration
Enhance Git workflows with plugins like:
- gitsigns.nvim for inline git status
- vim-fugitive for Git commands within Neovim
- diffview.nvim for Git diff viewing
Configuration example:
-- Git integration
require('gitsigns').setup{
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '‾' },
changedelete = { text = '~' },
},
}
Terminal Multiplexer Integration
Combine Neovim with tmux for a powerful terminal-based IDE:
Create a .tmux.conf
with Neovim-friendly settings:
# Enable vi mode
set-window-option -g mode-keys vi
# Better pane navigation
bind -n C-h select-pane -L
bind -n C-j select-pane -D
bind -n C-k select-pane -U
bind -n C-l select-pane -R
# Enable true color support
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*256col*:Tc"
Congratulations! You have successfully installed Neovim. Thanks for using this tutorial for installing Neovim on your Manjaro Linux system. For additional or useful information, we recommend you check the official Neovim website.