Installing NeoVim and Lazy (Package Manager)

Shaik Zahid
4 min readJan 30, 2023

--

In order to install Neovim, all you need to do is to find the Operating System you are using currently. Find the installation instructions and start the installation.

The package manager we are going to use is Packer instead of vim-plug as it is gaining popularity because of its configuration written in Lua programming language which has the ability to install many modern plugins for the development and enhancement of Neovim.

If you want to know more about Neovim you can have a go at their documentation which provides more depth about how to configure it.

You can visit Neovim Homepage or their Github Repository for detailed explanation of Neovim.

Linux :-

Linux has different flavors of distributions. In this article, we are only going to cover Arch Linux, Debian and Ubuntu as these are the widely used distributions in Linux. If your distribution doesn’t fall under any of these distributions then you can find more about Neovim installation here.

  1. Debian and Ubuntu

Ubuntu is also a debian based distribution and is quite popular among new developers. All you need to do is run the following command for installing neovim inside your system.

sudo apt-get install neovim

2. Arch Linux

Arch Linux uses pacman as its package manager, hence the command will be slightly different from Debian and Ubuntu.

sudo pacman -Syu neovim

Mac-OS :-

For Mac-OS, the default package manager is Homebrew.

brew install neovim
  • If you want to go with the pre-built releases of Neovim then do this instead.
curl -LO https://github.com/neovim/neovim/releases/download/nightly/nvim-macos.tar.gz
tar xzf nvim-macos.tar.gz
./nvim-macos/bin/nvim

Windows :-

Installing Neovim in Windows Operating System is the hardest part of them all. One way to easily install Neovim is to download the executable file from the latest stable release page.

Just download the Nvim-win64.msi installation file and install just as any other software. There are some other methods but this is the best suitable one for Windows.

If you want to install from the command line then you need to have a package manager like Chocolatey or Scoop.

  • Using Chocolatey:
choco install neovim
  • Using Scoop:
scoop bucket add extras
scoop install vcredist2022
scoop install neovim

First Steps After Installing Neovim

  • If you have installed Neovim successfully then we can get started with the configuration and turn it into a full featured IDE.
  • The initial step is to create a file named init.lua inside your nvim folder. This is the main configuration file which is the root of your Neovim Configuration. We will split the configuration in many different files and source them in our main configuration file (init.vim).
  • This nvim directory should reside in a location that depends on your Operating System.
  • If you are using Linux/MacOS, then the location should be ~/.config and the absolute path should be ~/.config/nvim/init.lua
  • If you are using Windows Operating System, then the location is C:\Users\your_username\Appdata\local\ and the absolute path should be C:\Users\your_username\Appdata\local\nvim\init.lua

Lazy (Package Manager)

  • Lazy is currently the best package manager for Neovim. It is completely implemented in Lua programming language.
Elegant and Blazingly Fast UI for managing plugins
  • It provides a beautiful and fast UI for managing plugins, and reduces our loading time with a feature called lazy-loading.
  • You can check the start-up speed comparison of Packer and Lazy here.
  • To get started with Lazy, We need to create a new folder lua inside our nvim directory which we created before.
  • Create a new file named lazy-config.lua, where we can install our plugin manager and source it to init.vim file.
  • Add the following code to your lazy-config.lua file. This code basically checks whether the plugin manager is installed in your system. If it is not installed, it will automatically install it.
-- lazy-config.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", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
  • You can take this code from the Installation section of the github repository.
  • After inserting the code, Close the file with the command <Esc>:wq.
  • All you need to do is to source this file in main configuration file.
  • Now Open your init.vim file and add the following code.
-- init.lua

require "lazy-config"

Neovim From Scratch

  • If you want a complete installation and configuration of Neovim from Scratch, then you can head over to my NEOVIM SERIES.
  • This series is updated regularly, with updates and inclusion of newer plugins which improves the wholesome IDE experience of Neovim.

--

--