How to Install Neovim on Fedora Linux

Neovim is a modern fork of Vim designed for extensibility and usability, making it an excellent choice for editing configuration files, programming in Python or Lua, writing scripts, and managing server files via SSH on Fedora. Unlike traditional Vim, Neovim supports asynchronous plugins, built-in LSP (Language Server Protocol) for intelligent code completion, and a Lua-based configuration system that enables powerful customizations. By the end of this guide, you will have Neovim installed and verified on your Fedora system, ready for configuration with your preferred plugins and settings.

Choose Your Neovim Installation Method

Fedora offers two primary ways to install Neovim, each with distinct advantages. The following table summarizes the key differences to help you decide which approach fits your workflow.

MethodChannelVersionUpdatesBest For
DNF (Fedora Repos)Fedora PackagesStableAutomatic via dnf upgradeMost users who prefer distro-tested packages
Flatpak (Flathub)FlathubLatest stableAutomatic via flatpak updateUsers wanting newer releases with sandboxing

We recommend the DNF method for most users because it integrates seamlessly with system updates and has no sandboxing restrictions that might affect plugin functionality. Only use Flatpak if you specifically need the latest version or prefer application isolation.

Method 1: Install Neovim from Fedora Repositories

Update System Packages

First, refresh your package cache and update existing packages to ensure you install Neovim against the latest system libraries.

sudo dnf upgrade --refresh

Install Neovim with DNF

Next, install Neovim from Fedora’s official repositories. DNF will automatically resolve and install all required dependencies.

sudo dnf install neovim

Verify the Installation

After installation completes, verify that Neovim is accessible by checking its version.

nvim --version

Expected output showing version information confirms the installation succeeded:

NVIM v0.11.x
Build type: RelWithDebInfo
LuaJIT 2.1.x

Method 2: Install Neovim via Flatpak and Flathub

Alternatively, the Flatpak method provides a sandboxed installation with potentially newer releases than the Fedora repositories. Since Flatpak is pre-installed on Fedora Workstation, you only need to ensure the Flathub repository is enabled.

Enable Flathub Repository

First, add the Flathub repository if it’s not already configured. The --if-not-exists flag prevents errors if Flathub was previously added.

sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

Install Neovim from Flathub

With Flathub enabled, install Neovim using the following command.

flatpak install flathub io.neovim.nvim -y

Verify the Flatpak Installation

After installation, verify that Flatpak registered the application correctly.

flatpak info io.neovim.nvim

Expected output showing the application details confirms the installation:

Neovim - Vim-fork focused on extensibility and usability

          ID: io.neovim.nvim
         Ref: app/io.neovim.nvim/x86_64/stable
        Arch: x86_64
      Branch: stable
      Origin: flathub
     Version: 0.11.x

Launch Neovim

Launch Neovim from Terminal

If you installed Neovim using DNF, launch it directly from the terminal.

nvim

Alternatively, open a specific file for editing by passing the filename as an argument.

nvim ~/.bashrc

For the Flatpak installation, use the full application ID to launch Neovim.

flatpak run io.neovim.nvim

To simplify launching the Flatpak version, create a shell alias by adding alias nvim='flatpak run io.neovim.nvim' to your ~/.bashrc file, then run source ~/.bashrc to apply the change.

Launch Neovim from Applications Menu

Neovim also appears in the GNOME application menu after installation. To access it through the graphical interface, open Activities by clicking the top-left corner or pressing the Super key, then search for “Neovim” and click the icon to launch.

Configure Neovim

Once Neovim is installed, you can customize it by creating a configuration file. Neovim supports both Vimscript (init.vim) and Lua (init.lua) for configuration. For new users, the Lua-based approach is recommended because it offers better performance and a cleaner syntax.

First, create the Neovim configuration directory if it doesn’t exist.

mkdir -p ~/.config/nvim

Next, create a basic Lua configuration file with common settings.

cat <<'EOF' > ~/.config/nvim/init.lua
-- Basic Neovim configuration
vim.opt.number = true           -- Show line numbers
vim.opt.relativenumber = true   -- Relative line numbers
vim.opt.expandtab = true        -- Use spaces instead of tabs
vim.opt.shiftwidth = 4          -- Indent by 4 spaces
vim.opt.tabstop = 4             -- Tab equals 4 spaces
vim.opt.termguicolors = true    -- Enable 24-bit colors
vim.opt.clipboard = 'unnamedplus' -- Use system clipboard
EOF

Now when you launch Neovim, it will apply these settings automatically. For advanced configuration including plugin management, consider exploring lazy.nvim (modern plugin manager) or kickstart.nvim (complete starter configuration).

Manage Neovim

Update Neovim

To keep Neovim current, regularly update your applications to receive the latest security patches and features. The update method depends on how you installed Neovim.

Update DNF Installation

DNF-installed Neovim receives updates through the standard system upgrade process.

sudo dnf upgrade --refresh

Update Flatpak Installation

For Flatpak installations, update all Flatpak applications including Neovim with the following command.

flatpak update

Remove Neovim

If you need to remove Neovim from your system, use the appropriate command based on your installation method.

Remove DNF Installation

To uninstall your DNF-based Neovim and remove unused dependencies, run the following commands.

sudo dnf remove neovim
sudo dnf autoremove

Remove Flatpak Installation

To uninstall the Flatpak version of Neovim along with its application data, use the following commands.

flatpak uninstall io.neovim.nvim -y
flatpak uninstall --unused

The second command removes any orphaned runtimes that only Neovim used.

Remove Configuration Files

Warning: The following commands permanently delete your Neovim configuration, plugins, and cached data. Back up any customizations you want to keep before proceeding.

Uninstalling Neovim does not remove your personal configuration files. To completely remove all Neovim data including plugins and settings, delete the following directories.

rm -rf ~/.config/nvim
rm -rf ~/.local/share/nvim
rm -rf ~/.local/state/nvim
rm -rf ~/.cache/nvim

For Flatpak installations, also remove the sandboxed application data.

rm -rf ~/.var/app/io.neovim.nvim

Troubleshooting

Clipboard Not Working

If copying and pasting between Neovim and other applications fails, verify that clipboard support is available by running the following command inside Neovim.

:checkhealth

Look for the clipboard section in the output. If it shows warnings, install the required clipboard provider. On Wayland (default on Fedora), install wl-clipboard. On X11, install xclip.

sudo dnf install wl-clipboard

Plugin Manager Fails to Install Plugins

Most Neovim plugin managers require Git to clone plugin repositories. Verify that your system has Git available.

git --version

If Git is not installed, add it with the following command.

sudo dnf install git

Flatpak Version Cannot Access Host Files

By default, Flatpak sandboxes applications with limited file system access. If you need to edit files outside your home directory, grant additional permissions using Flatseal or the command line.

flatpak override --user --filesystem=host io.neovim.nvim

This grants Neovim access to the entire file system, similar to the DNF-installed version.

Conclusion

You now have Neovim installed on Fedora, ready for customization with plugins and configurations. The DNF method provides seamless integration with system updates, while Flatpak offers sandboxing and potentially newer releases. To enhance your development workflow, explore plugin managers like lazy.nvim for adding features such as syntax highlighting, fuzzy finding, and LSP support. For version control integration, consider installing Git on Fedora and exploring Neovim plugins like fugitive.vim or neogit. If you prefer a more traditional IDE experience, compare Neovim with VSCodium or Visual Studio Code on Fedora.

Leave a Comment