DEV Community

Cover image for My Nvim setup process
Kevin Expósito
Kevin Expósito

Posted on • Edited on

My Nvim setup process

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
Enter fullscreen mode Exit fullscreen mode

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 
Enter fullscreen mode Exit fullscreen mode

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'
Enter fullscreen mode Exit fullscreen mode

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
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)

" 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
Enter fullscreen mode Exit fullscreen mode

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
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
gnome terminal pref

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
Enter fullscreen mode Exit fullscreen mode

Image description

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
nvim screenshot

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

Top comments (5)

Collapse
 
casonadams profile image
Cason Adams

So you might enjoy alacritty-shell for alacritty terminal colors, or walh-shell for other terminals. Then you can use walh as your vim colorscheme AND it will match your terminal colors.

Collapse
 
kexposito profile image
Kevin Expósito

Awesome! That is new for me and I will take s look at that!

Collapse
 
gr8arty profile image
Artyom • Edited

I switched over from vim to neovim lately, I like it more now because of some handy plugins, like Telescope.
And as to personalization, my personal choice when it comes to the font is github.com/JetBrains/JetBrainsMono and regarding theming I prefer github.com/morhetz/gruvbox, a perfect combo!

Oh, and I love this smoothie scrolling as well github.com/psliwka/vim-smoothie

And this is my favourite plugin so far github.com/ThePrimeagen/harpoon
But sure, there're way more...

Collapse
 
kexposito profile image
Kevin Expósito • Edited

Sweet ! I tried gruvbox but I could't get used to. But I would like to try it again right now :P. Regarding Vim-smoothie That's new for me! What I use for scrolling is:

set scrolloff=10 " Allow 10 lines margin when scrolling

I never tried harpoon but I need to! (Primeagen <3)

Collapse
 
gr8arty profile image
Artyom

Yep, it takes time to finally find out your favorite theme...
but I like many things that Primeagen advice xD

and just in case, here are my mappings for harpoon plugin:

< leader >a :lua require("harpoon.mark").add_file()
< leader >h :lua require("harpoon.ui").toggle_quick_menu()
< leader >o :lua require("harpoon.ui").nav_next()
< leader >i :lua require("harpoon.ui").nav_prev()