Skip to content

Latest commit

 

History

History
68 lines (51 loc) · 1.46 KB

DEVELOPER.md

File metadata and controls

68 lines (51 loc) · 1.46 KB

API

" returns the font character that represents the icon
" parameters: a:1 (filename), a:2 (isDirectory)
" both parameters optional
" by default without parameters uses buffer name
WebDevIconsGetFileTypeSymbol(...)

" returns the font character that represents
" the file format as an icon (windows, linux, mac)
WebDevIconsGetFileFormatSymbol()

Public Methods

" Returns the current version of the plugin
webdevicons#version()
" Calls webdevicons#softRefresh()
" basically a backwards compatibility convenience
webdevicons#refresh()
" Does a 'hard' refresh of NERDTree
" resets vim-devicons syntax and closes and reopens NERDTree
webdevicons#hardRefresh()
" Does a 'soft' refresh of NERDTree
" resets vim-devicons syntax and toggles NERDTree to the same state
webdevicons#softRefresh()

API Examples

Status line

Custom vim status line (not relying on vim-airline or lightline):

set statusline=%f\ %{WebDevIconsGetFileTypeSymbol()}\ %h%w%m%r\ %=%(%l,%c%V\ %Y\ %=\ %P%)
Simple function call
echo WebDevIconsGetFileFormatSymbol()

Integration with other plugins

vim-startify
let entry_format = "'   ['. index .']'. repeat(' ', (3 - strlen(index)))"

if exists('*WebDevIconsGetFileTypeSymbol')  " support for vim-devicons
  let entry_format .= ". WebDevIconsGetFileTypeSymbol(entry_path) .' '.  entry_path"
else
  let entry_format .= '. entry_path'
endif