NeoVim vim-devicons are not loaded in Windows Terminal (PowerShell)

4k Views Asked by At

I'm running Neovim (nvim) from Windows Terminal Powershell and recently installed a vim-devicons via vim-plug. I noticed that the icons are not displayed. In my configuration of Windows Terminal I'm using Cascadia Code PL a required font to display Oh-my-posh and posh-my-git, however even having apparently capable font neovim doesn't display it. However if I open nvim-qt it does work (perhaps it doesn't include its own terminal emulator). Is there any way to tweak config in neovim to properly display vim-devicons in windows terminal?

Here it is my profile.json:

{
      // Make changes here to the powershell.exe profile
      "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
      "name": "Windows PowerShell",
      "commandline": "powershell.exe",
      "fontFace": "Cascadia Code PL",
      "fontSize": 9,
      "useAcrylic": true,
      "acrylicOpacity": 0.7,
      "backgroundImage": "ms-appdata:///roaming/midnight_smuggler_1280x720.jpg",
      "backgroundImageOpacity": 0.4,
      "colorScheme": "cyberpunk",
      "hidden": false
    },

And my local nvim config:

"Plugin Section
call plug#begin('~/.vim/plugged')
   Plug 'scrooloose/nerdtree'
   Plug 'ryanoasis/vim-devicons'
call plug#end()


"Config
set encoding=UTF-8
"set guifont=
let g:NERDTreeShowHidden = 1
let g:NERDTreeMinimalUI = 1
let g:NERDTreeIgnore = []
let g:NERDTreeStatusline = ''
" Automaticaly close nvim if NERDTree is only thing left open
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Toggle
 nnoremap <silent> <C-b> :NERDTreeToggle<CR>
2

There are 2 best solutions below

0
Mr_LinDowsMac On

Just figured that I was using a Cascadia Code PL that just have just enough glyphs for Oh-my-posh, just configured Delugia Nerd Font instead and Windows Terminal display icons.

1
Shyam Bhattacharyya On

It is a very common problem with many users after their very first installation of vim-airline or NERDTree plugins. So here are a few steps you have to carry out to see the icons in the vim-airline as well as in the NERDTree plugin.

Step 1

Install vim-devicons https://github.com/ryanoasis/vim-devicons using any plugin manager (I prefer vim-plug for this. https://github.com/junegunn/vim-plug) and place it just before the call plug#end() command or try to load this plugin at the end of all other plugins(if you are using any other methods to install your plugin) and at the next line paste set encoding=UTF-8 example:

call plug#begin()
.
.
.
Plug 'https://github.com/ryanoasis/vim-devicons'
set encoding=UTF-8
call plug#end()

Step 2

Paste the following code after the previous loop

let g:NERDTreeDirArrowExpandable="+"
let g:NERDTreeDirArrowCollapsible="~"

" air-line
let g:airline_powerline_fonts = 1

if !exists('g:airline_symbols')
    let g:airline_symbols = {}
endif

" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
" airline symbols                                                                                                                              
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''

let g:WebDevIconsUnicodeDecorateFolderNodes = 1
let g:WebDevIconsUnicodeDecorateFolderNodeDefaultSymbol = ''

let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {}
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['nerdtree'] = ''

Step 3

Download any of the font from https://www.nerdfonts.com/font-downloads. I prefer DejaVuSansMono Nerd Font.

Step 4

unzip DejaVuSansMono.zip and do mv ~/.fonts and cd ~/.fonts

Step 5

Finally you have to run fc-cache -fv to manually rebuild the font cache. Now reopen the vim or nvim and now you will find that the icons are visible correctly. Kindly up vote my answer.