Skip to content
Ryan L McIntyre edited this page Mar 11, 2018 · 7 revisions

VimDevIcons - Adds Icons to Your Plugins

Usage

If you installed and setup things correctly you should now see icons in the supported plugins!

Notes on include order:

Lightline Setup and Powerline Setup require some extra setup as shown below:

Lightline Setup

To add the appropriate icon to lightline, call the function WebDevIconsGetFileTypeSymbol() and/or WebDevIconsGetFileFormatSymbol() in your .vimrc. For example, you could set your sections to:

let g:lightline = {
      \ 'component_function': {
      \   'filetype': 'MyFiletype',
      \   'fileformat': 'MyFileformat',
      \ }
      \ }

function! MyFiletype()
  return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : ''
endfunction

function! MyFileformat()
  return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : ''
endfunction

Powerline Setup

To enable for Powerline some vimrc and powerline configuration changes are needed:

vimrc changes (only required if you don't already have powerline setup for vim):

set rtp+=$HOME/.local/lib/python2.7/site-packages/powerline/bindings/vim/

" Always show statusline
set laststatus=2

" Use 256 colours (Use this setting only if your terminal supports 256 colours)
set t_Co=256

powerline configuration changes:

file type segment

{
	"function": "vim_devicons.powerline.segments.webdevicons",
	"priority": 10,
	"draw_soft_divider": false,
	"after": "  "
}

file format segment

{
	"function": "vim_devicons.powerline.segments.webdevicons_file_format",
	"draw_soft_divider": false,
	"exclude_modes": ["nc"],
	"priority": 90
 }

for full example see sample file