Install Neovim on RHEL 9

Install Neovim on RHEL 9

Learn how to install NeoVim on RHEL 9 with this step-by-step guide. Includes CLI examples, configuration tips, and plugin setup to enhance your editing experience on RHEL.

Table of Contents

Introduction

Neovim is a powerful, extensible text editor that’s rapidly gaining traction among developers, system administrators, and power users. With features like better plugin management, asynchronous job control, and enhanced performance over Vim, Neovim is an essential tool for many. This guide will walk you through the steps to install NeoVim on RHEL 9, from installing dependencies to launching your first NeoVim session. We’ll also cover some basic configurations to get you started.

Why NeoVim on RHEL 9?

If you’re working on RHEL 9 Workstation, you may find the default editor, vim, to be somewhat limiting. NeoVim offers a modern take, maintaining compatibility with Vim configurations while adding enhancements that appeal to coders and sysadmins alike.

Key Benefits of NeoVim:

  • Improved performance with async support
  • Extensible plugin system
  • Cross-platform support
  • Enhanced UI with terminal-based GUI plugins

Install NeoVim on RHEL 9 | Step-by-Step Guide

Step 1: Prepare Your System

Before diving into the installation, ensure your system is updated. This helps avoid conflicts during the installation process.

				
					sudo dnf update -y
				
			

Step 2: Install Prerequisites

Neovim requires several libraries and development tools. Use the command below to install the necessary packages.

				
					sudo dnf install -y gcc make cmake unzip curl gettext tar xclip
				
			

Step 3: Install Neovim

Neovim is available in the Extra Packages for Enterprise Linux (EPEL) repository, making installation straightforward on RHEL 9. Below, we’ll cover how to enable EPEL and install Neovim.

Option 1: Install from the EPEL Repository

Enable the EPEL Repository: The EPEL repository provides access to additional packages, including Neovim:

				
					sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
				
			
				
					sudo dnf install epel-release -y
				
			

Install NeoVim and Dependencies: Now that EPEL is enabled, install NeoVim along with all required dependencies:

				
					sudo dnf install neovim -y
				
			

The installation includes essential packages like libvterm, luajit, msgpack, and others to support NeoVim’s extended features.

Install Neovim on RHEL 9

Photo by admingeek from Infotechys

Verify the Installation: Check the installation and version to confirm NeoVim is ready:

				
					nvim --version
				
			
Install Neovim on RHEL 9

Photo by admingeek from Infotechys

Option 2: Download and Install the AppImage (Alternative Method)

If you prefer to use the latest AppImage release from GitHub, follow these steps:

Download the Neovim AppImage
				
					curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
				
			
Make the AppImage executable
				
					chmod u+x nvim.appimage
				
			
Move Neovim to a directory in your PATH for easy access
				
					sudo mv nvim.appimage /usr/local/bin/nvim
				
			
Verify the installation
				
					nvim --version
				
			
				
					NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info
				
			

Step 4: Set Up Neovim Configuration

Neovim, like Vim, uses a configuration file (init.vim) to manage settings. Let’s create this file and set some basic configurations.

				
					mkdir -p ~/.config/nvim
				
			
				
					touch ~/.config/nvim/init.vim
				
			

Add some initial configurations by editing init.vim:

				
					vim ~/.config/nvim/init.vim
				
			

Here’s a simple starter configuration:

				
					" Enable line numbers
set number

" Enable syntax highlighting
syntax on

" Use spaces instead of tabs
set expandtab
set tabstop=4
set shiftwidth=4
				
			

Step 5: Install NeoVim Plugin Manager (Optional)

For plugin management, vim-plug is a popular choice. It’s efficient, lightweight, and easy to use.

				
					vim ~/.config/nvim/init.vim
				
			

Install vim-plug:

				
					curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
				
			

Add Plugin Configurations to init.vim:

Here’s how to add a sample plugin, such as gruvbox for a color theme:

				
					call plug#begin('~/.config/nvim/plugged')
Plug 'morhetz/gruvbox'
call plug#end()

call plug#begin('~/.local/share/nvim/plugged')
Plug 'tpope/vim-sensible'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
call plug#end()
				
			

This configuration tells NeoVim where to look for plugins and specifies a few sample plugins.

Install the Plugin in Neovim:

Open Neovim and run the following command to install the plugin:

				
					:PlugInstall
				
			
Install Neovim on RHEL 9

Photo by admingeek from Infotechys

Step 6: Verify Your Installation

After setting up Neovim, check to make sure it’s working correctly.

Open Neovim

				
					nvim
				
			

Open the Command Mode and Check Plugins

In Neovim, press : to open the command mode, then type :PlugStatus to see the status of your plugins.

Neovim Install Verification: PlugStatus

Photo by admingeek from Infotechys

Neovim Installation Summary Table

StepDescriptionCommand
System UpdateUpdate your RHEL 9 systemsudo dnf update -y
Install PrerequisitesInstall essential tools and librariessudo dnf install -y gcc make cmake unzip curl gettext tar xclip
Download NeovimDownload the Neovim AppImagecurl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
Set PermissionsMake AppImage executablechmod u+x nvim.appimage
Move to PATHMove Neovim to a directory in PATHsudo mv nvim.appimage /usr/local/bin/nvim
Verify InstallationCheck Neovim versionnvim --version
Create Config FileSet up Neovim configurationmkdir -p ~/.config/nvim and touch ~/.config/nvim/init.vim
Install vim-plugInstall Plugin Managercurl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Neovim CLI Examples for Quick Customization

Below are some CLI examples and commands you can use to customize and enhance your Neovim experience.

Setting a Custom Color Scheme

To set a new color scheme, add the following line to your init.vim file. For instance, using the popular gruvbox theme:

				
					" Set Color Scheme:
colorscheme gruvbox
				
			

Then reload your configuration:

				
					source ~/.config/nvim/init.vim

				
			

Key Mapping for Faster Navigation

Key mappings can save you time. Here’s an example to remap the jk key combination to exit insert mode:

				
					" Set Key Mappings:
inoremap jk <Esc>
				
			

Step 7: Explore Additional Neovim Plugins

Neovim supports various plugins that can improve productivity, especially for coding. Here are some popular plugins:

PluginPurposeInstallation Command in init.vim
NERDTreeFile ExplorerPlug 'preservim/nerdtree'
coc.nvimLanguage Server Protocol (LSP) supportPlug 'neoclide/coc.nvim', {'branch': 'release'}
lightline.vimLightweight status linePlug 'itchyny/lightline.vim'
vim-airlineEnhanced status/tab linePlug 'vim-airline/vim-airline'
vim-commentaryQuick commentingPlug 'tpope/vim-commentary'
vim-surroundEasy manipulation of surrounding charactersPlug 'tpope/vim-surround'

To install these plugins, add the corresponding Plug command in the init.vim file and then run :PlugInstall in Neovim.

				
					call plug#begin('~/.local/share/nvim/plugged')
" List plugins below:

Plug 'preservim/nerdtree'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'itchyny/lightline.vim'
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'

call plug#end()
				
			
				
					:PlugInstall
				
			
Additional Plugin Installs in Neovim

Photo by admingeek from Infotechys

Troubleshooting Common Issues

Neovim Not Found in Path

Ensure the AppImage file was moved to /usr/local/bin or another directory in your PATH. Run echo $PATH to confirm.

Permission Denied on Plugin Install

This often occurs if you’re trying to install plugins in a directory without write permissions. Ensure you have ownership of the ~/.config/nvim/plugged directory.

Neovim Freezes with Heavy Plugins

Some plugins may slow Neovim. Consider disabling or limiting plugins if you encounter performance issues.

Conclusion

By following these steps, you’ve successfully installed and configured Neovim on RHEL 9. This setup provides you with a powerful, customizable editor that enhances productivity and aligns with modern coding practices. As you grow more familiar with Neovim, explore additional plugins, themes, and configurations that suit your workflow.

Did you find this article useful? Your feedback is invaluable to us! Please feel free to share your thoughts in the comments section below and share this post!

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *