My Nvim setup process
Tags: vim, nvim, ubuntu, tutorial
Published: 2022-02-18 01:00:26

Some of us have some special configurations and guides we like to follow for some tools like bspwm, sxhkd, polybar, terminal, etc. And here is mine for Vim, which I want to share with you.

⚠️ Make sure you have git installed, because one of our vim plugins will need that in order to work correctly.


## Download Nvim 
Go to https://github.com/neovim/neovim/releases and select the latest version from nvim and check `Assets` and download `nvim.appimage`.

## Installing Nvim
Open a terminal and copy the code below
```
cd ~/Downloads
chmod u+x nvim.appimage && ./nvim.appimage

sudo mv nvim.appimage /usr/local/bin
sudo chmod +x /usr/local/bin/nvim.appimage
```
In my case that I want to rename it i will run the following command (you can also declare an alias for it).
```
sudo mv /usr/local/bin/nvim.appimage /usr/local/bin/vim 
```

And that's it! we have Nvim installed and ready to go, but lets add some pretty configurations.


### Install VimPlug
You can install VimPlug by running:
```
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
   https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
```

and create the following directory:
`mkdir ~/.config/nvim/`
`mkdir ~/.config/nvim/plugged` (I will use this folder in our init.config)

If you are having any issue with this please follow the instructions here: https://github.com/junegunn/vim-plug#unix-linux

## Init.vim
![superpower](https://media.giphy.com/media/VDXi0uEieSFC856ado/giphy.gif)
You shoud create the following file:
`vim ~/.config/nvim/init.vim` and fill it with your configuration.
Here is my init.vim, but I **strongly** suggest to use the things that you like and you feel comfortable with. And just adapt this guide to your preferences.

https://gist.github.com/kexposito/6a22cf04e83402c64b77c1434e63bef5

## Installing addons
Now that we copy, or added some Plugs we are ready to
open vim and run `:PlugInstall`. (In case you already have addons)
I will create a guide for the most used addons by myself so keep tune.

### Adding colorscheme to our Nvim
Let's create a **color** folder.

`mkdir ~/.config/nvim/colors`
And create a file named `railscasts.vim`
`vim ~/.config/nvim/colors/railscasts.vim`
and paste the following code https://gist.github.com/kexposito/16ed1d356d5bdcdc6709573a9e61e9b8
(This railscasts.vim file was taken from https://github.com/cedarcode/cedarvim)

```vim
" To use for gvim:
" 1: install this file as ~/.vim/colors/railscasts.vim
" 2: put "colorscheme railscasts" in your .gvimrc
"
" If you are using Ubuntu, you can get the benefit of this in your
" terminals using ordinary vim by taking the following steps:
"
" 1: sudo apt-get install ncurses-term
" 2: put the following in your .vimrc
"     if $COLORTERM == 'gnome-terminal'
"         set term=gnome-256color
"         colorscheme railscasts
"     else
```

Following the guide proposed in cedarvim, after this make sure to install `ncurses-term` by running `sudo apt-get install ncurses-term`.

## Configure terminal to have a good looking
![cool](https://media.giphy.com/media/MURsKMKVsVgXu/giphy.gif)
Let's start by changing the terminal theme to _solirized_ one 😎

1. Open gnome terminal
2. Right click in terminal
3. Preferences
4. Unnamed
5. Colors
6. Unselect "use colors from system themes" and select "Solarized Dark". Another cool option would be "Gnome Dark"

![gnome terminal](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/30zwem046ed8ycmpekir.png)
![gnome terminal pref](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zy4w608w83u7xa063uzn.png)

## Extra - Add custom fonts
Add Mononoki font to Ubuntu
1. Go to https://www.nerdfonts.com/font-downloads and search for "Mononoki Nerd Font" (here is a preview of it https://www.programmingfonts.org/#mononoki)
2. Download
3. Open a terminal and run:
```
mkdir /usr/local/share/fonts/Mononoki
cp ~/Downloads/Mononoki.zip /usr/local/share/fonts/Mononoki
unzip /usr/local/share/fonts/Mononoki/Mononoki.zip
rm /usr/local/share/fonts/Mononoki/Mononoki.zip
sudo fc-cache -fv
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/drfeezp50n2sk90f1t4i.png)

If you had any issue following these steps here is a guide for you too https://www.addictivetips.com/ubuntu-linux-tips/ubuntu-install-fonts-guide/

And now you should be able to select it:
1. Open gnome terminal
2. Right click in terminal
3. Preferences
4. Unnamed
5. Select custom font -> mononoki Nerd Font Mono

If you have permissions issues use `sudo`

## 📸 Screenshots 📸

![nvim screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6duj2y8ydzzecm8jqw93.png)
![nvim screenshot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7oek37iccatbr2kq5b8i.png)

If you have any special config file or keymapping that you can't work without it please share with us!