Powerline fonts, Devicon glyphs, URXVT, Neo VIM

For over a year I had been trying to get these to work together, but I had never been able to get them to play together. I tried installing Powerline fonts, Nerd fonts (the full set) different versions of URXVT, different versions of nvim, but the results were always the same, a bunch of disrespectful and awkward looking characters littered my editor and my terminal emulator. The good news is that I finally figured out how to fix it.

First, let me talk about my setup

OS: Arch Linux, Terminal Emulator: URXVT-UNICODE, Editor: NEO VIM

My big mistake was that I never set my Locale. You can find out if you have set the locale by typing “locale”. If your system is set up correctly, you should see some entries that resemble en_XX.UTF-8. Where XX represents your country.

You can take a screen capture by typing in “scrot -s” on the console and selecting the screen area using the mouse

If you haven’t set this up you should. This should be your first order of business. Nothing works without setting your locale.

To set up your locale open locale.gen located in /etc/ folder. Uncomment the locale that you are interested in. The type “sudo locale-gen” or ‘ sudo locale-gen “en_IN.UTF-8” ‘ (in my case). If you type locale again, you should see something similar to the screenshot above

Now that you have set up your locale, its time to install the fonts. On Arch,1 I installed the following. (You may not need to install all of them. But at the time I was confused, so I installed them all

sudo pacman -S powerline-fonts otf-powerline-symbols

Then, install powerline itself

sudo pacman -S powerline2 and sudo pip install powerline-status

Next, Install Devicon fonts (again, I wasn’t sure which was needed and which was not needed. Its found in the AUR. I used trizen, you might want to use yourt

trizen -S ttf-devicons vim-devicons and sudo pacman -S nerd-fonts-complete

We have the fonts and the glyphs, but we need to test if it is installed and working so test it out by running a script. You can find a nifty script here

Copy the script to a file on your root folder and name it “fonttest.sh”. After you save it, make sure to give it execute permissions “chmod +755 fonttest.sh”. Now run it on your console.

. fonttest.sh

You should see something like this on the console. If fonts look awkward, there is something wrong.

Now it’s time to configure vim. I use vimplug. You may use a different plugin system like pathogen.

Plug ‘vim-airline/vim-airline’
Plug ‘vim-airline/vim-airline-themes’
Plug ‘bling/vim-bufferline’
Plug ‘ryanoasis/vim-devicons’

Install your plugins by running ” PlugInstall” at the VIM prompt ( “shift :” ). restart VIM. I opted to install vim-airline instead of vim-powerline for personal reasons (or was it because I couldn’t figure out powerline… cant’ remember). I had additional configurations added (it’s in the documentation)

let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ‘ ‘
let g:airline#extensions#tabline#left_alt_sep = ‘|’
let g:airline_powerline_fonts = 1
let g:airline_theme=’badwolf’
:nnoremap :bnext
:nnoremap :bprevious
:nnoremap :bdelete

let g:webdevicons_enable = 1
let g:webdevicons_enable_nerdtree = 1
” adding the column to vimfiler
let g:webdevicons_enable_vimfiler = 1
” adding to vim-airline’s tabline
let g:webdevicons_enable_airline_tabline = 1
” adding to vim-airline’s statusline
let g:webdevicons_enable_airline_statusline = 1
” ctrlp glyphs
let g:webdevicons_enable_ctrlp = 1
” enable open and close folder/directory glyph flags (disabled by default with 0)
let g:DevIconsEnableFoldersOpenClose = 1
” enable folder/directory glyph flag (disabled by default with 0)
let g:WebDevIconsUnicodeDecorateFolderNodes = 1
” change the default folder/directory glyph/icon
let g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol = ‘ƛ’

Also the following for NerdTree, since the plugins support configuring the NerdTree plugin

function OpenNERDTree()
execute “:NERDTree”
command -nargs=0 OpenNERDTree :call OpenNERDTree()

nmap t :OpenNERDTree
let g:NERDTreeDirArrowExpandable = ‘▸’
let g:NERDTreeDirArrowCollapsible = ‘▾’
” NERDTress File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
exec ‘autocmd FileType nerdtree highlight ‘ . a:extension .’ ctermbg=’. a:bg .’ ctermfg=’. a:fg .’ guibg=’. a:guibg .’ guifg=’. a:guifg
exec ‘autocmd FileType nerdtree syn match ‘ . a:extension .’ #^\s+.*’. a:extension .’$#’

call NERDTreeHighlightFile(‘jade’, ‘green’, ‘none’, ‘green’, ‘#151515’)
call NERDTreeHighlightFile(‘ini’, ‘yellow’, ‘none’, ‘yellow’, ‘#151515’)
call NERDTreeHighlightFile(‘md’, ‘blue’, ‘none’, ‘#3366FF’, ‘#151515’)
call NERDTreeHighlightFile(‘yml’, ‘yellow’, ‘none’, ‘yellow’, ‘#151515’)
call NERDTreeHighlightFile(‘config’, ‘yellow’, ‘none’, ‘yellow’, ‘#151515’)
call NERDTreeHighlightFile(‘conf’, ‘yellow’, ‘none’, ‘yellow’, ‘#151515’)
call NERDTreeHighlightFile(‘json’, ‘yellow’, ‘none’, ‘yellow’, ‘#151515’)
call NERDTreeHighlightFile(‘html’, ‘yellow’, ‘none’, ‘yellow’, ‘#151515’)
call NERDTreeHighlightFile(‘styl’, ‘cyan’, ‘none’, ‘cyan’, ‘#151515’)
call NERDTreeHighlightFile(‘css’, ‘cyan’, ‘none’, ‘cyan’, ‘#151515’)
call NERDTreeHighlightFile(‘coffee’, ‘Red’, ‘none’, ‘red’, ‘#151515’)
call NERDTreeHighlightFile(‘js’, ‘Red’, ‘none’, ‘#ffa500’, ‘#151515’)
call NERDTreeHighlightFile(‘php’, ‘Magenta’, ‘none’, ‘#ff00ff’, ‘#151515’)
call NERDTreeHighlightFile(‘ds_store’, ‘Gray’, ‘none’, ‘#686868’, ‘#151515’)
call NERDTreeHighlightFile(‘gitconfig’, ‘Gray’, ‘none’, ‘#686868’, ‘#151515’)
call NERDTreeHighlightFile(‘gitignore’, ‘Gray’, ‘none’, ‘#686868’, ‘#151515’)
call NERDTreeHighlightFile(‘bashrc’, ‘Gray’, ‘none’, ‘#686868’, ‘#151515’)
call NERDTreeHighlightFile(‘bashprofile’, ‘Gray’, ‘none’, ‘#686868’, ‘#151515’)
autocmd VimEnter * call NERDTreeHighlightFile(‘jade’, ‘green’, ‘none’, ‘green’, ‘#151515’)

That’s about it. If you search google you will find a lot of references about urxvt-unicode not being able to support devicons, nerdfonts, powerline fonts etc. It may be true for some configurations, but it worked for me. Some also say that you have to play around with your .Xresources until the fonts start working

Mine is

URxvt*font: xft:Inconsolata Nerd Font Mono:size=15, xft:DejaVu Sans:size=12
URxvt.depth: 32

URxvttermName: rxvt-unicode URxvtborderless: 0
URxvtscrollBar: false URxvtsaveLines: 2000
URxvttransparent: true URxvtshading: 25
!URxvtletterSpace: -1 URxvtscrollBar_right: false
URxvtscrollstyle: plain

Shoot me a note… if you have comments or questions.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: