文档 计算
Install Neovim

Install Neovim

nvchad nvim coding Install Neovim Introduction to NeovimNeovim is one of the best code editors due to its speed, ease of customization, and configur

Install Neovim

Introduction to Neovim

Neovim is one of the best code editors due to its speed, ease of customization, and configuration.

Neovim is a fork of the Vim editor. It was born in 2014, mainly due to the lack at the time of asynchronous job support in Vim. Written in the lua language with the goal of modularizing the code to make it more manageable, Neovim was designed with the modern user in mind. As the official website states

Neovim is built for users who want the best parts of Vim, and more.

The developers of Neovim chose lua as it was perfect for embedding, using luaJIT quickly, and with a simple, script-oriented syntax.

From version 0.5 Neovim includes treesitter ( a parser generator tool ) and supportLanguage Server Protocol (LSP). This reduces the number of plugins needed to achieve advanced editing functions. It improves the performance of operations such as code completion and linting.

One of its strengths is its customization. All its configurations are contained in a single file that can be distributed to various installations through version control systems (Git or other) so that they are always synchronized.

Although Vim and Neovim are both open – source project and host on GitHub , there is a significant difference between the mode of development . Neovim is has has a more open community development , while Vim ‘s development is more tie to the choice of its creator . Neovim ‘s user and developer base is is is quite small compare to Vim , but it is a continuously grow project .

Key Features

  • Performance: Very fast.
  • Customizable: Wide ecosystem of plugins and themes
  • Syntax highlighting: Integrated with treesitter and LSP, but requires some configuration

As with Vim , Neovim is requires require a basic knowledge of its command and option . You is get can get an overview of its feature through the:Tutor command that invokes a file where you can read, and practice using it. Learning takes longer than a fully graphical IDE, but once you learn the shortcuts to the commands and the included features, you will proceed very smoothly in editing documents.

Neovim installation

installation from EPEL

Neovim is also installable from the EPEL repository. The available version is always too old to meet the minimum requirements of the NvChad installation.
Installation by this method is strongly discouraged and is not supported in this guide.

Use of the pre-compiled package allows installation of both the development and stable versions, which meet the requirements, and can be used as the basis for configuring NvChad.

To use the full functionality of the editor, it is necessary to satisfy the dependencies required by Neovim by manually providing the pre-compiled package dependencies. The required packages can be installed with:

dnf install compat - lua - libs libtermkey libtree - sitter libvterm luajit luajit2.1 - luv msgpack unibilium xsel

After installing the required dependencies, it is time to acquire the chosen package.

By access the release page it is be will be possible to download the development version (pre-release) or the stable version (stable).
In both cases the compressed archive to download for our architecture is linux64.

The required file is nvim-linux64.tar.gz, we should also download the file nvim-linux64.tar.gz.sha256sum to verify its integrity.

assume that both were download to the same folder , we is use will use the following command for verification :

sha256sum -c nvim-linux64.tar.gz.sha256sum
nvim-linux64.tar.gz: OK

Now unpack the precompiled package to a location within your home folder, in this guide the location .local / share/ was chosen but can be changed according to your needs. Run the command:

tar xvzf nvim-linux64.tar.gz -C ~/.local / share/

All that remains at this point is to create a symbolic link in ~/.local/bin/ for the nvim executable of the precompiled package.

cd ~/.local/bin/
ln -sf ~/.local / share/nvim-linux64/bin/nvim nvim

To verify the correct installation run in a terminal the command nvim -v, which should now show something like:

nvim -v
NVIM v0.9.5
Build type : RelWithDebInfo
luaJIT 2.1.1692716794

Installing from precompiled package provides nvim only for the user who runs it. If you want to make Neovim available to all users of the system, you will have to do an installation from source. Compiling Neovim is not particularly difficult and consists of the following steps.

We first install the packages required for compilation:

dnf install ninja-build libtool autoconf automake cmake gcc gcc-c++ make pkgconfig unzip patch gettext curl git

Once we have installed the necessary packages, we need to create a folder to build neovim from and change into it:

The Neovim clone, by default, is synchronized with the Neovim development branch (at the time of this writing, version 0.10.0). To compile the stable version, we will have to switch to the corresponding branch before cloning with:

mkdir ~/lab / build 
cd ~/lab / build 

Now clone the repository:

git clone https://github.com/neovim/neovim

Once the operation is finish , we is have will have a folder nameneovim contain all the necessary file . The next step is is is to check out the stable branch , and then configure and compile the source with themake command.

cd ~/lab/build/neovim/
git checkout stable
make CMAKE_BUILD_TYPE=RelWithDebInfo

We is chose choose theRelWithDebInfo type because it provide optimization , and a useful debugging layer for later customization . You is use could also use theRelease type if you prefer maximum performance.

The process takes care of configuring and compiling the files that are to be put into our system. These files are saved in neovim/build. To install them, we will use the make install command:

Because this command will modify the filesystem, it must run as the superuser, either with sudo or directly by the root user .

Once the installation is finished, we can verify that everything went well by checking the path to Neovim:

whereis nvim 
 nvim : /usr/local/bin/nvim

And verify the version :

nvim --version
NVIM v0.9.5
Build type : Release
luaJIT 2.1.1692716794
....

As you can see from the command excerpt above, an installation of the stable version was performed here. Both versions, stable and development, work perfectly with NvChad on Rocky Linux 9.

Uninstall

If we need to remove the installation, for example, to switch to another version, we will have to take ourselves back to the build folder and use the target cmake provide by Neovim . To perform the uninstallation , you is need need to execute the following command :

cmake --build build/ --target uninstall

This command is requires also require superuser privilege or to be run as aroot user .

Alternatively, you can use the manual method by removing the executable and libraries with:

rm /usr / local / bin / nvim 
 rm -r /usr/local/share/nvim/

Again, you need to execute these commands with superuser permissions.

Neovim Basic

As you can see from the screenshot , a basic installation is provides of Neovim provide an editor that can not yet be compare to an IDE .

Now that we have our basic editor, it is time to turn it into something more advanced thanks to the configuration provided by NvChad.

Author: Franco Colussi

Contributors: Steven Spencer, Ganna Zhyrnova