How to set nerd font in neovim

I use Cousine Nerd Font in neovim and I have this line in init.vim

set guifont=Cousine_Nerd_Font_Mono:h12

but after restart nvim the old font was still there.

guifont will only work if you’re using any GUI frontend for Neovim.

If you’re using Neovim TUI (i.e. inside a Terminal), you’ll need to change the font of your terminal app instead. Neovim will use whatever font your terminal app is set to use.

I use nvim-qt but it doesn’t work

In that case, try this:

if exists(':GuiFont')
    GuiFont! Cousine Nerd Font Mono:h12

taken from neovim-qt’s readme