How to set up NvChad on Linux (Ubuntu for me)

How to set up NvChad on Linux (Ubuntu for me)

NvChad is a set of configurations for Neovim, a command-line based text editor. Neovim is the latest version of Vim, which uses Lua, which is easy to understand and configure.

Install Neovim

First of all, open your terminal and type the two following commands :-

curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage

chmod u+x nvim.appimage

Now, if you have fuse installed, do the following :-

./nvim.appimage

This should open neovim.

Now, to use neovim globally as "nvim" :

mkdir -p /opt/nvim
mv nvim.appimage opt/nvim/nvim

And add the following line to ~/.bashrc :

export PATH="$PATH:/opt/nvim/"

Now, if the ./nvim.appimage command fails (you probably don't have Fuse installed), do the following :-

./nvim.appimage --appimage-extract
./squashfs-root/AppRun
# this should run neovim

# using nvim globally
sudo mv squashfs-root /
sudo ln -s /squashfs-root/AppRun /usr/bin/nvim
nvim

Now, just typing "nvim" should open Neovim in the terminal.

Install NvChad

You need to have a nerd font set as your terminal font for NvChad to work properly. Find what you like the most over here : https://www.nerdfonts.com/font-downloads

An optional requirement is ripgrep, which is used for file previews while searching files using Telescope (Neovim plugin for searching files). Read more about it here : https://github.com/BurntSushi/ripgrep?tab=readme-ov-file

There is just one command for installing the NvChad configurations.

git clone https://github.com/NvChad/NvChad ~/.config/nvim --depth 1 && nvim

Now, run nvim in your terminal. It might look something like this :

NvChad comes with its own dashboard NvDash, but it is disabled by default. To enable it, you can override it in the /lua/custom/chadrc.lua file :

M.ui = {
    nvdash = {
        load_on_startup = true,
    },
}

Now, restart neovim. It should look like this :

You can customise more of NvDash, by going to the /lua/custom/highlights.lua file and add this :

M.override = {
    NvDashAscii = {
        fg = "blue",
        bg = "one_bg",
    },
}

For this exact code, my NvDash looks like this :

You may customise this however you like. Keep searching Google and NvChad Docs to learn more of their features.

Some commonly used shortcuts

Neovim is all about key-bindings. Here are some of them which I frequently use :

(NOTE: the leader key is the Spacebar)

  • Ctrl + Shift + n : Opens NvimTree, which is like a file explorer. You can see the files and folders in your current directory.

  • leader + e : Places the cursor from the document to NvimTree, so that you can choose and open a file.

  • leader + n : Toggle line number display.

  • leader + f + f : Telescope Find Files. Opens telescope, and you can use it to search a file.

  • leader + f + o : Telescope Recent Files. Opens telescope to search for recently opened files.

  • leader + t + h : Change the theme of neovim. There are a lot of options to choose from.

  • leader + c + h : Opens a cheatsheet provided by NvChad. It has a number of other useful key-bindings and their uses. Very helpful for people new to this.

That's all!

You have successfully installed and set up Neovim and NvChad on your Linux machine! Refer to the official docs of NvChad to explore further into this and customise your experience further to your liking.

Like this blog and follow me if this helped you:

Linkedin: https://www.linkedin.com/in/amartya-chowdhury/