├── .gitignore ├── autoload └── airline │ └── extensions │ └── tabline │ └── formatters │ └── webdevicons.vim ├── LICENSE ├── nerdtree_plugin └── webdevicons.vim ├── changelog.md ├── plugin └── webdevicons.vim ├── readme.md └── doc └── webdevicons.txt /.gitignore: -------------------------------------------------------------------------------- 1 | tests/ 2 | tests-for-preview/ 3 | -------------------------------------------------------------------------------- /autoload/airline/extensions/tabline/formatters/webdevicons.vim: -------------------------------------------------------------------------------- 1 | function! airline#extensions#tabline#formatters#webdevicons#format(bufnr, buffers) 2 | " Call original formatter. 3 | let originalFormatter = airline#extensions#tabline#formatters#{g:_webdevicons_airline_orig_formatter}#format(a:bufnr, a:buffers) 4 | return originalFormatter . ' ' . WebDevIconsGetFileTypeSymbol(bufname(a:bufnr)) . ' ' 5 | endfunction 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Ryan L McIntyre 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /nerdtree_plugin/webdevicons.vim: -------------------------------------------------------------------------------- 1 | 2 | " @todo fix duplicate global variable initialize here: 3 | if !exists('g:webdevicons_enable') 4 | let g:webdevicons_enable = 1 5 | endif 6 | 7 | if !exists('g:webdevicons_enable_nerdtree') 8 | let g:webdevicons_enable_nerdtree = 1 9 | endif 10 | 11 | " Temporary (hopefully) fix for glyph issues in gvim (proper fix is with the 12 | " actual font patcher) 13 | if !exists('g:webdevicons_gui_glyph_fix') 14 | let g:webdevicons_gui_glyph_fix = 1 15 | endif 16 | 17 | if g:webdevicons_enable_nerdtree == 1 18 | if !exists('g:loaded_nerd_tree') 19 | echohl WarningMsg | 20 | \ echomsg "vim-webdevicons requires NERDTree to be loaded before vim-webdevicons." 21 | endif 22 | 23 | if exists('g:loaded_nerd_tree') && g:loaded_nerd_tree == 1 && !exists('g:NERDTreePathNotifier') 24 | let g:webdevicons_enable_nerdtree = 0 25 | echohl WarningMsg | 26 | \ echomsg "vim-webdevicons requires a newer version of NERDTree to show glyphs in NERDTree - consider updating NERDTree." 27 | endif 28 | 29 | " @todo I don't even want this to execute UNLESS the user has the 30 | " 'nerdtree-git-plugin' INSTALLED (not LOADED) 31 | " As it currently functions this warning will display even if the user does 32 | " not have nerdtree-git-plugin not just if it isn't loaded yet 33 | " (not what we want) 34 | "if !exists('g:loaded_nerdtree_git_status') 35 | " echohl WarningMsg | 36 | " \ echomsg "vim-webdevicons works better when 'nerdtree-git-plugin' is loaded before vim-webdevicons (small refresh issues otherwise)." 37 | "endif 38 | endif 39 | 40 | if !exists('g:webdevicons_enable_airline_tabline') 41 | let g:webdevicons_enable_airline_tabline = 1 42 | endif 43 | 44 | if !exists('g:webdevicons_enable_airline_statusline') 45 | let g:webdevicons_enable_airline_statusline = 1 46 | endif 47 | 48 | function! s:SetupListeners() 49 | call g:NERDTreePathNotifier.AddListener("init", "NERDTreeWebDevIconsRefreshListener") 50 | call g:NERDTreePathNotifier.AddListener("refresh", "NERDTreeWebDevIconsRefreshListener") 51 | call g:NERDTreePathNotifier.AddListener("refreshFlags", "NERDTreeWebDevIconsRefreshListener") 52 | endfunction 53 | 54 | " Temporary (hopefully) fix for glyph issues in gvim (proper fix is with the 55 | " actual font patcher) 56 | 57 | " NERDTree-C 58 | " scope: global 59 | function! WebDevIconsNERDTreeChangeRootHandler(node) 60 | call a:node.makeRoot() 61 | call NERDTreeRender() 62 | call a:node.putCursorHere(0, 0) 63 | redraw! 64 | endfunction 65 | 66 | " NERDTree-u 67 | " scope: global 68 | function! WebDevIconsNERDTreeUpDirCurrentRootClosedHandler() 69 | call nerdtree#ui_glue#upDir(0) 70 | redraw! 71 | endfunction 72 | 73 | if g:webdevicons_enable == 1 && g:webdevicons_enable_nerdtree == 1 74 | call s:SetupListeners() 75 | 76 | " Temporary (hopefully) fix for glyph issues in gvim (proper fix is with the 77 | " actual font patcher) 78 | if g:webdevicons_gui_glyph_fix == 1 && has("gui_running") 79 | call NERDTreeAddKeyMap({ 80 | \ 'key': g:NERDTreeMapChangeRoot, 81 | \ 'callback': 'WebDevIconsNERDTreeChangeRootHandler', 82 | \ 'override': 1, 83 | \ 'quickhelpText': "change tree root to the\n\" selected dir\n\" plus webdevicons redraw\n\" hack fix", 84 | \ 'scope': 'Node' }) 85 | 86 | call NERDTreeAddKeyMap({ 87 | \ 'key': g:NERDTreeMapUpdir, 88 | \ 'callback': 'WebDevIconsNERDTreeUpDirCurrentRootClosedHandler', 89 | \ 'override': 1, 90 | \ 'quickhelpText': "move tree root up a dir\n\" plus webdevicons redraw\n\" hack fix", 91 | \ 'scope': 'all' }) 92 | endif 93 | endif 94 | 95 | 96 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | - v0.4.3 2 | - Prevent error 'Unknown function' when opening Vim without airline plugin (Fixes #67) 3 | - Temporary fix for gvim glyph artifact issues (particuarly NERDTree) (Fixes #58) 4 | - Support file format symbols (glyphs) in vim-airline (Enhancement #66) 5 | - Add vimrc setup example to readme (Documentation #65) 6 | - Fixes Conceal highlighting issues (Fixes #53, #52) 7 | - Make sure plugin plays nice with [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin) (Enhancement #62) 8 | - general readme updates and improvements 9 | - changelog format fixes 10 | - v0.4.2 11 | - Updated vim doc with latest readme updates (html2vimdoc) 12 | - Fixes #7 update readme for font and vim setup on osx and win platforms 13 | - Fixes #49 with a FAQ update 14 | - Fixes #41 No such event: nerdtree syntax match (@nbicalcarata) 15 | - Removed test files from the repo and added folders to git-ignore 16 | - Warn about loading vim-webdevicons before nerdtree plugin 17 | - fix lazy NERDTree (@blueyed) 18 | - Improve conceiling with NERDTree (@blueyed) 19 | - add instructions to readme for vim setup on os x (@alfredbez) 20 | - v0.4.1 21 | - Fixes #39 - updated screenshots (particularly nerdtree) 22 | - Fixes #37 - g:webdevicons_conceal_nerdtree_brackets applying global config 23 | - Add instructions to readme for adding icon to lightline (@hoop33) 24 | - Updated vim doc with latest readme updates (sync'd with html2vimdoc) 25 | - Added TL;DR section to readme 26 | - Add a note to readme to load NERDTree before vim-webdevicons (@hoop33) 27 | - Fix: Automatically turning off NERDTree support (@hoop33) 28 | - general readme updates 29 | - v0.4.0 30 | - #27 Remove [ ] wrapping icons 31 | - #26 Add detection and warning on unsupported (old) NERDTree versions 32 | - updated readme with more links and new details on new features and conifgs 33 | - #30 Improve vim standard plugin conventions and tips 34 | - #30 work on sections and standard plugin conventions part 1 35 | - #30 clean-up of unused (for now) autoload file 36 | - #28 setting global options broken part 1 37 | - #29 Add vimdoc, more updates 38 | - autogenerating vimdoc using html2vimdoc 39 | - readme updates 40 | - v0.3.4 41 | - Adds basic support for directory/folder glyphs - fixes #22 42 | - optimize icon lookup - WebDevIconsGetFileTypeSymbol: use if/else (@blueyed) 43 | - Do not clobber the default or customized airline formatter (@blueyed) 44 | - fixed a bug related to the latest airline updates (Ali Aliev) 45 | - various readme updates 46 | - more sample usage images 47 | - v0.3.3 48 | - Load the plugin once only (@blueyed) 49 | - Add font installation instructions, fixes #5 (@wikimatze) 50 | - added plugin install instructions 51 | - slight readme re-ordering 52 | - moved contributing section near bottom 53 | - added additional screenshots 54 | - added more thanks to those whose some more of the glyphs came from 55 | - v0.3.2 56 | - moved screenshots into the wiki (wiki.vim-webdevicons) to reduce unnecessary project size of cloning repo 57 | - v0.3.1 58 | - readme updates (with references to new font-patcher repo) 59 | - readme updates screenshots reference wiki 60 | - v0.3.0 61 | - moved font-patcher and patched fonts into a separate repo (nerd-filetype-glyphs-fonts-patcher) 62 | - adds twigg file type support for #10 (@wikimatze) 63 | - adds cpp file type support 64 | - updated utf8 test file with glyphs 65 | - readme fixes (@wikimatze, @blueyed) 66 | - readme updates 67 | - v0.2.1 68 | - readme updates 69 | - v0.2.0 70 | - Script for patching any font: Initial cleaned up work for issue (feature enhancement) for #1 71 | - added python font patcher and readme updates 72 | - v0.1.4 73 | - readme updates 74 | - v0.1.3 75 | - fixes #3 make matches case insensitive (ignore case) 76 | - v0.1.2 77 | - fixes lookup for exact file notes (@johngeorgewright) 78 | - v0.1.1 79 | - updated readme substantially 80 | - v0.1.0 81 | - release 82 | -------------------------------------------------------------------------------- /plugin/webdevicons.vim: -------------------------------------------------------------------------------- 1 | " Version: 0.4.3 2 | " Webpage: https://github.com/ryanoasis/vim-webdevicons 3 | " Maintainer: Ryan McIntyre 4 | " Licencse: see LICENSE 5 | 6 | let s:version = '0.4.3' 7 | 8 | " standard fix/safety: line continuation (avoiding side effects) {{{1 9 | "======================================================================== 10 | let s:save_cpo = &cpo 11 | set cpo&vim 12 | 13 | " standard loading / not loading {{{1 14 | "======================================================================== 15 | 16 | if exists('g:loaded_webdevicons') 17 | finish 18 | endif 19 | 20 | let g:loaded_webdevicons = 1 21 | 22 | " config enable / disable settings {{{1 23 | "======================================================================== 24 | 25 | if !exists('g:webdevicons_enable') 26 | let g:webdevicons_enable = 1 27 | endif 28 | 29 | if !exists('g:webdevicons_enable_nerdtree') 30 | let g:webdevicons_enable_nerdtree = 1 31 | endif 32 | 33 | if !exists('g:webdevicons_enable_airline_tabline') 34 | let g:webdevicons_enable_airline_tabline = 1 35 | endif 36 | 37 | if !exists('g:webdevicons_enable_airline_statusline') 38 | let g:webdevicons_enable_airline_statusline = 1 39 | endif 40 | 41 | if !exists('g:webdevicons_enable_airline_statusline_fileformat_symbols') 42 | let g:webdevicons_enable_airline_statusline_fileformat_symbols = 1 43 | endif 44 | 45 | if !exists('g:webdevicons_conceal_nerdtree_brackets') 46 | let g:webdevicons_conceal_nerdtree_brackets = 1 47 | endif 48 | 49 | 50 | " config options {{{1 51 | "======================================================================== 52 | 53 | let g:WebDevIconsUnicodeDecorateFileNodes = 1 54 | 55 | " whether to show default folder glyphs on directories: 56 | let g:WebDevIconsUnicodeDecorateFolderNodes = 0 57 | 58 | " whether to try to match folder notes with any exact file node matches 59 | " default is to match but requires WebDevIconsUnicodeDecorateFolderNodes set 60 | " to 1: 61 | if !exists('g:WebDevIconsUnicodeDecorateFolderNodesExactMatches') 62 | let g:WebDevIconsUnicodeDecorateFolderNodesExactMatches = 1 63 | endif 64 | 65 | if !exists('g:WebDevIconsUnicodeGlyphDoubleWidth') 66 | let g:WebDevIconsUnicodeGlyphDoubleWidth = 1 67 | endif 68 | 69 | if !exists('g:WebDevIconsNerdTreeAfterGlyphPadding') 70 | let g:WebDevIconsNerdTreeAfterGlyphPadding = ' ' 71 | endif 72 | 73 | 74 | " config defaults {{{1 75 | "======================================================================== 76 | 77 | if !exists('g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol') 78 | let g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol = '' 79 | endif 80 | 81 | if !exists('g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol') 82 | let g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol = '' 83 | endif 84 | 85 | " functions {{{1 86 | "======================================================================== 87 | 88 | " local functions {{{2 89 | "======================================================================== 90 | 91 | " scope: local 92 | function! s:setDictionaries() 93 | 94 | let s:file_node_extensions = { 95 | \ 'styl' : '', 96 | \ 'scss' : '', 97 | \ 'htm' : '', 98 | \ 'html' : '', 99 | \ 'css' : '', 100 | \ 'less' : '', 101 | \ 'md' : '', 102 | \ 'json' : '', 103 | \ 'js' : '', 104 | \ 'rb' : '', 105 | \ 'php' : '', 106 | \ 'py' : '', 107 | \ 'pyc' : '', 108 | \ 'pyo' : '', 109 | \ 'pyd' : '', 110 | \ 'coffee' : '', 111 | \ 'mustache' : '', 112 | \ 'hbs' : '', 113 | \ 'conf' : '', 114 | \ 'ini' : '', 115 | \ 'yml' : '', 116 | \ 'jpg' : '', 117 | \ 'jpeg' : '', 118 | \ 'bmp' : '', 119 | \ 'png' : '', 120 | \ 'gif' : '', 121 | \ 'ai' : '', 122 | \ 'twig' : '', 123 | \ 'cpp' : '', 124 | \ 'c++' : '', 125 | \ 'cxx' : '', 126 | \ 'cc' : '', 127 | \ 'cp' : '', 128 | \ 'c' : '', 129 | \ 'hs' : '', 130 | \ 'lhs' : '', 131 | \ 'lua' : '', 132 | \ 'java' : '', 133 | \ 'sh' : '', 134 | \ 'diff' : '', 135 | \ 'db' : '', 136 | \ 'clj' : '', 137 | \ 'scala' : '', 138 | \ 'go' : '', 139 | \ 'dart' : '', 140 | \ 'xul' : '', 141 | \ 'sln' : '', 142 | \ 'suo' : '' 143 | \} 144 | 145 | let s:file_node_exact_matches = { 146 | \ 'exact-match-case-sensitive-1.txt' : 'X1', 147 | \ 'exact-match-case-sensitive-2' : 'X2', 148 | \ 'gruntfile.coffee' : '', 149 | \ 'gruntfile.js' : '', 150 | \ 'gruntfile.ls' : '', 151 | \ 'gulpfile.coffee' : '', 152 | \ 'gulpfile.js' : '', 153 | \ 'gulpfile.ls' : '', 154 | \ 'dropbox' : '' 155 | \} 156 | 157 | if !exists('g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols') 158 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} 159 | endif 160 | 161 | if !exists('g:WebDevIconsUnicodeDecorateFileNodesExactSymbols') 162 | " do not remove: exact-match-case-sensitive-* 163 | let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols = {} 164 | endif 165 | 166 | " iterate to fix allow user overriding of specific individual keys in vimrc (only gvimrc was working previously) 167 | for [key, val] in items(s:file_node_extensions) 168 | if !has_key(g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols, key) 169 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols[key] = val 170 | endif 171 | endfor 172 | 173 | " iterate to fix allow user overriding of specific individual keys in vimrc (only gvimrc was working previously) 174 | for [key, val] in items(s:file_node_exact_matches) 175 | if !has_key(g:WebDevIconsUnicodeDecorateFileNodesExactSymbols, key) 176 | let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols[key] = val 177 | endif 178 | endfor 179 | 180 | endfunction 181 | 182 | " scope: local 183 | function! s:setSyntax() 184 | if g:webdevicons_conceal_nerdtree_brackets == 1 185 | augroup webdevicons_conceal_nerdtree_brackets 186 | au! 187 | autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\]" contained conceal containedin=ALL 188 | autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\[" contained conceal containedin=ALL 189 | autocmd FileType nerdtree set conceallevel=3 190 | autocmd FileType nerdtree set concealcursor=nvic 191 | augroup END 192 | endif 193 | endfunction 194 | 195 | " scope: local 196 | function! s:initialize() 197 | call s:setDictionaries() 198 | call s:setSyntax() 199 | endfunction 200 | 201 | " initialization {{{1 202 | "======================================================================== 203 | 204 | call s:initialize() 205 | 206 | " public functions {{{2 207 | "======================================================================== 208 | 209 | " scope: public 210 | function! webdevicons#version() 211 | return s:version 212 | endfunction 213 | 214 | " a:1 (bufferName), a:2 (isDirectory) 215 | " scope: public 216 | function! WebDevIconsGetFileTypeSymbol(...) 217 | if a:0 == 0 218 | let fileNodeExtension = expand("%:e") 219 | let fileNode = expand("%:t") 220 | let isDirectory = 0 221 | else 222 | let fileNodeExtension = fnamemodify(a:1, ':e') 223 | let fileNode = fnamemodify(a:1, ':t') 224 | if a:0 == 2 225 | let isDirectory = a:2 226 | else 227 | let isDirectory = 0 228 | endif 229 | endif 230 | 231 | let fileNodeExtension = tolower(fileNodeExtension) 232 | let fileNode = tolower(fileNode) 233 | 234 | if has_key(g:WebDevIconsUnicodeDecorateFileNodesExactSymbols, fileNode) 235 | let symbol = g:WebDevIconsUnicodeDecorateFileNodesExactSymbols[fileNode] 236 | elseif has_key(g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols, fileNodeExtension) 237 | let symbol = g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols[fileNodeExtension] 238 | else 239 | if isDirectory == 1 240 | let symbol = g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol 241 | else 242 | let symbol = g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol 243 | endif 244 | endif 245 | 246 | " Temporary (hopefully) fix for glyph issues in gvim (proper fix is with the 247 | " actual font patcher) 248 | let artifactFix = "\u00A0" 249 | 250 | return symbol . artifactFix 251 | 252 | endfunction 253 | 254 | function! WebDevIconsGetFileFormatSymbol(...) 255 | let fileformat = "" 256 | 257 | if &fileformat == "dos" 258 | let fileformat = "" 259 | elseif &fileformat == "unix" 260 | let fileformat = "" 261 | elseif &fileformat == "mac" 262 | let fileformat = "" 263 | endif 264 | 265 | " Temporary (hopefully) fix for glyph issues in gvim (proper fix is with the 266 | " actual font patcher) 267 | let artifactFix = "\u00A0" 268 | 269 | return &enc . " " . fileformat . artifactFix 270 | endfunction 271 | 272 | " for airline plugin {{{3 273 | "======================================================================== 274 | 275 | " scope: global 276 | function! AirlineWebDevIcons(...) 277 | let w:airline_section_x = get(w:, 'airline_section_x', g:airline_section_x) 278 | let w:airline_section_x .= ' %{WebDevIconsGetFileTypeSymbol()} ' 279 | if g:webdevicons_enable_airline_statusline_fileformat_symbols 280 | let w:airline_section_y = ' %{WebDevIconsGetFileFormatSymbol()} ' 281 | endif 282 | endfunction 283 | 284 | if g:webdevicons_enable == 1 && exists("g:loaded_airline") && g:loaded_airline == 1 && g:webdevicons_enable_airline_statusline 285 | call airline#add_statusline_func('AirlineWebDevIcons') 286 | endif 287 | 288 | if g:webdevicons_enable == 1 && g:webdevicons_enable_airline_tabline 289 | " Store original formatter. 290 | if exists('g:airline#extensions#tabline#formatter') 291 | let g:_webdevicons_airline_orig_formatter = g:airline#extensions#tabline#formatter 292 | else 293 | let g:_webdevicons_airline_orig_formatter = 'default' 294 | endif 295 | let g:airline#extensions#tabline#formatter = 'webdevicons' 296 | endif 297 | 298 | " for nerdtree plugin {{{3 299 | "======================================================================== 300 | 301 | " scope: public 302 | function! NERDTreeWebDevIconsRefreshListener(event) 303 | let path = a:event.subject 304 | let padding = g:WebDevIconsNerdTreeAfterGlyphPadding 305 | let prePadding = '' 306 | let hasGitFlags = (len(path.flagSet._flagsForScope("git")) > 0) 307 | 308 | if g:WebDevIconsUnicodeGlyphDoubleWidth == 0 309 | let padding = '' 310 | endif 311 | 312 | if hasGitFlags && g:WebDevIconsUnicodeGlyphDoubleWidth == 1 313 | let prePadding = ' ' 314 | endif 315 | 316 | if !path.isDirectory 317 | let flag = prePadding . WebDevIconsGetFileTypeSymbol(path.str()) . padding 318 | elseif path.isDirectory && g:WebDevIconsUnicodeDecorateFolderNodes == 1 319 | if g:WebDevIconsUnicodeDecorateFolderNodesExactMatches == 1 320 | let flag = prePadding . WebDevIconsGetFileTypeSymbol(path.str(), path.isDirectory) . padding 321 | else 322 | let flag = prePadding . g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol 323 | endif 324 | else 325 | let flag = '' 326 | endif 327 | 328 | call path.flagSet.clearFlags("webdevicons") 329 | 330 | if flag != '' 331 | call path.flagSet.addFlag("webdevicons", flag) 332 | endif 333 | 334 | endfunction 335 | 336 | " standard fix/safety: line continuation (avoiding side effects) {{{1 337 | "======================================================================== 338 | let &cpo = s:save_cpo 339 | unlet s:save_cpo 340 | 341 | " vim: fdm=marker: 342 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | vim-webdevicons 2 | ======================= 3 | [![GitHub version](https://badge.fury.io/gh/ryanoasis%2Fvim-webdevicons.svg)][badge-version] [![Join the chat at https://gitter.im/ryanoasis/vim-webdevicons](https://img.shields.io/badge/%E2%8A%AA%20GITTER%20-CHAT%20%E2%86%92-1dce73.svg?style=flat)][badge-gitter] [![Flattr this git repo](https://img.shields.io/badge/donate-flattr%20this!-8DB65B.svg?style=flat)][badge-flattr] 4 | 5 | Adds filetype glyphs (icons) to other vim plugins such as [NERDTree], [vim-airline], and [lightline.vim]. 6 | 7 | [» Vote for upcoming features or suggest new ones](#vote) 8 | 9 | ![image](https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.4.3/overall-screenshot.png) 10 | 11 | 12 | 15 | 16 | 17 |  _Current open polls: Vote for upcoming features or suggest new ones:_ | [vote](https://github.com/ryanoasis/vim-webdevicons/labels/poll) 18 | ------------------------------------------------------------------------- | :-----: 19 | » [Rename project: vim-webdevicons to vim-devicons?](https://github.com/ryanoasis/vim-webdevicons/issues/64) | [☑](http://poll.gitrun.com/ryanoasis/vim-webdevicons/issues/64) 20 | » [support ctrlp.vim?](https://github.com/ryanoasis/vim-webdevicons/issues/56) | [☑](http://poll.gitrun.com/ryanoasis/vim-webdevicons/issues/56) 21 | » [support unite.vim?](https://github.com/ryanoasis/vim-webdevicons/issues/54) | [☑](http://poll.gitrun.com/ryanoasis/vim-webdevicons/issues/54) 22 | » [Something else? (Open an issue)](https://github.com/ryanoasis/vim-webdevicons/labels/poll) | [☑](https://github.com/ryanoasis/vim-webdevicons/labels/poll) 23 | 24 | 27 | 28 | ## Table of Contents 29 | 30 | - [vim-webdevicons v0.4.3](#) 31 | - [Quick Setup (TL;DR)](#quick-setup) 32 | - [Usage](#usage) 33 | - [Font Configuration](#font-configuration) 34 | - [Font Installation](#font-installation) 35 | - [Screenshots](#screenshots) 36 | - [Features](#features) 37 | - [Extra Configuration](#extra-configuration) 38 | - [character mappings](#character-mappings) 39 | - [Installation](#installation) 40 | - [Lightline](#lightline.vim) 41 | - [Todo](#todo) 42 | - [FAQ / Troubleshooting](#faq--troubleshooting) 43 | - [Contributing](#contributing) 44 | - [Rationale](#rationale) 45 | - [Inspiration and special thanks](#inspiration-and-special-thanks) 46 | - [License](#license) 47 | 48 | 49 | 50 | ## Quick Setup (TL;DR) 51 | 52 | 1. Install the plugin per your usual method _[(» More details... «)](#installation)_ 53 | 2. Download and install a patched font (or patch your own): 54 | * [nerd-filetype-glyphs-fonts-patcher] _[(» More details... «)](#font-installation)_ 55 | 3. Set font _[(» More details... «)](#font-configuration)_ 56 | * a. If using **vim**: Set your terminal emulator font 57 | * b. If using **gvim**: Set `guifont` in your `vimrc` 58 | 59 | ## Usage 60 | 61 | After installing the patched font and setting the vim font just open [NERDTree] 62 | or look at [airline][vim-airline] (statusline or tabline). 63 | 64 | * _NOTE:_ if you don't `guifont` set and are not running gvim you will need to set the terminal font. 65 | 66 | * _NOTE:_ for [NERDTree] support, you **must** configure vim to load NERDTree **_before_** vim-webdevicons loads. 67 | 68 | * _NOTE:_ for [vim-airline] support, you **must** configure vim to load vim-airline **_before_** vim-webdevicons loads. 69 | 70 | * _NOTE:_ for better [nerdtree-git-plugin] support, you _should_ configure vim to load nerdtree-git-plugin **_before_** vim-webdevicons loads. 71 | 72 | ## Font Configuration 73 | 74 | * Encoding **must** be set to UTF-8 for the glyphs to show 75 | ```vim 76 | set encoding=utf8 77 | ``` 78 | 79 | * The _ONLY_ other configuration needed should be setting the font vim uses to a 80 | patched font. 81 | 82 | Already patched fonts and the font patcher script are provided at: 83 | [nerd-filetype-glyphs-fonts-patcher] 84 | 85 | It works without configuration *ONLY* when used with a patched font provided in 86 | the separate repository above. Install the font and add it to your `vimrc` or 87 | `gvimrc`: 88 | 89 | Linux 90 | ```vim 91 | set guifont= 92 | ``` 93 | 94 | OS X and Windows 95 | ```vim 96 | set guifont=:h 97 | ``` 98 | 99 | e.g. 100 | 101 | Linux 102 | ```vim 103 | set guifont=Droid\ Sans\ Mono\ for\ Powerline\ Plus\ Nerd\ File\ Types\ 11 104 | ``` 105 | 106 | OS X and Windows 107 | ```vim 108 | set guifont=Droid\ Sans\ Mono\ for\ Powerline\ Plus\ Nerd\ File\ Types:h11 109 | ``` 110 | 111 | ## Font Installation 112 | 113 | You basically have to put any font you would like to use into the `~/.fonts` folder. For example: 114 | 115 | 116 | ```sh 117 | cd ~/.fonts && curl -fLo DroidSansMonoForPowerlinePlusNerdFileTypes.otf https://raw.githubusercontent.com/ryanoasis/nerd-filetype-glyphs-fonts-patcher/master/patched-fonts/Droid%20Sans%20Mono%20for%20Powerline%20Plus%20Nerd%20File%20Types.otf 118 | ``` 119 | 120 | 121 | You can find more fonts under my [patched fonts repo][font-nerd-icons-patched-fonts]. 122 | 123 | 124 | ## Screenshots 125 | 126 | ![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.4.3/vim.png) 127 | 128 | ### [NERDTree] 129 | 130 | ![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.4.3/nerdtree.png) 131 | 132 | ### [vim-airline] 133 | 134 | section | preview 135 | ------------------- | ------------- 136 | statusline | ![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.4.3/airline-statusline.png) 137 | tabline | ![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.4.3/airline-tabline-1.png) 138 | tabline | ![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.4.3/airline-tabline-2.png) 139 | fileformats symbols | ![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.4.3/fileformats-symbols-sample.png) 140 | 141 | ### Different patched fonts example 142 | 143 | ![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.4.3/different-fonts-sample.png) 144 | 145 | ### [lightline.vim][lightline.vim] 146 | 147 | ![image](https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.4.3/lightline.png) 148 | 149 | ### [nerdtree-git-plugin] 150 | 151 | ![image](https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.4.3/nerdtree-git-plugin-sample.png) 152 | 153 | ### Various Terminal Emulators 154 | 155 | * gnome terminal 156 | 157 | ![image](https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.4.3/terminal-gnome-sample.png) 158 | 159 | * Urxvt terminal 160 | 161 | ![image](https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.4.3/terminal-urxvt-sample.png) 162 | 163 | ### Windows 164 | 165 | ![image](https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.4.3/windows-sample.png) 166 | 167 | ### Mac OS X 168 | 169 | **Help wanted: https://github.com/ryanoasis/vim-webdevicons/issues/32** 170 | 171 | ### Glyph set test file 172 | 173 | ![image](https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.4.3/glyph-set-test.png) 174 | 175 | ## Features 176 | * show developer file type glyphs from a font in various vim plugins, currently supports: 177 | * [NERDTree] 178 | * [vim-airline][vim-airline] (statusline and tabline) 179 | * [lightline.vim][lightline.vim] (statusline) 180 | * see: [lightline](#lightline) for setup 181 | * Adds a global config map of characters to file extensions (or entire filenames) 182 | * customizable and extendable filetype detections 183 | * ability to override predefined dictionary variable 184 | * if you are unhappy with the default glyph used you can choose your own 185 | * supports a range of file type extensions by default: 186 | * ```styl, scss, htm, html, css, less, md, json, js, rb, php, py, pyc, pyd, pyo, coffee, mustache, hbs, conf, ini, yml, jpg, jpeg, bmp, png, gif, ai, twig, cpp, c++, cc, cp, cxx, cpp, c, hs, lhs, lua, sh, diff, clj, dart, db, go, scala, sln, suo, xul``` 187 | * supports full filename matches, by default: 188 | * ```gruntfile.coffee, gruntfile.js, gruntfile.ls, gulpfile.coffee, gulpfile.js, gulpfile.ls, dropbox``` 189 | * font patcher ([nerd-filetype-glyphs-fonts-patcher]) 190 | * requires: python2, python-fontforge package 191 | * example usage 192 | > ./font-patcher unpatched-sample-fonts/Droid\ Sans\ Mono\ for\ Powerline.otf 193 | 194 | ## Extra Configuration 195 | 196 | * by default you should not *NEED* to configure anything to get the basics working 197 | * _NOTE:_ You *NEED* to use one of the patched font provided or patch your own ([nerd-filetype-glyphs-fonts-patcher]) _unless_ you want to configure the filetype to glyph mappings yourself for your current font 198 | * these options can be defined in your `vimrc` or `gvimrc` 199 | * the following options are provided however for overriding 200 | 201 | * enable/disable loading the plugin (default 1) 202 | ```vim 203 | let g:webdevicons_enable = 1 204 | ``` 205 | 206 | * enable/disable adding the flags to NERDTree (default 1) 207 | ```vim 208 | let g:webdevicons_enable_nerdtree = 1 209 | ``` 210 | 211 | * enable/disable adding to vim-airline's tabline (default 1) 212 | ```vim 213 | let g:webdevicons_enable_airline_tabline = 1 214 | ``` 215 | 216 | * enable/disable adding to vim-airline's statusline (default 1) 217 | ```vim 218 | let g:webdevicons_enable_airline_statusline = 1 219 | ``` 220 | 221 | * turn on/off file node glyph decorations (not particularly useful) 222 | ```vim 223 | let g:WebDevIconsUnicodeDecorateFileNodes = 1 224 | ``` 225 | 226 | * whether or not font is using double-width glyphs (default 1, set to 0 for single character width glyphs) 227 | * _note:_ does not actually switch the font or try to use the correct font, just adds a space to account for a double width glyph, you have to set the correct double width glyph font in your terminal or `guifont` 228 | ```vim 229 | let g:WebDevIconsUnicodeGlyphDoubleWidth = 1 230 | ``` 231 | 232 | * whether or not to show the nerdtree brackets around flags (default 1) 233 | ```vim 234 | let g:webdevicons_conceal_nerdtree_brackets = 1 235 | ``` 236 | 237 | * the amount of space to use after the glyph character (default ' ') 238 | ```vim 239 | let g:WebDevIconsNerdTreeAfterGlyphPadding = ' ' 240 | ``` 241 | 242 | ### character mappings 243 | 244 | * `ƛ` is used as an example below, substitute for the glyph you **actually** want to use 245 | 246 | * change the default character when no match found 247 | ```vim 248 | let g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol = 'ƛ' 249 | ``` 250 | 251 | * enable folder/directory glyph flag (disabled by default with 0) 252 | ```vim 253 | let g:WebDevIconsUnicodeDecorateFolderNodes = 1 254 | ``` 255 | 256 | * enable custom folder/directory glyph exact matching (enabled by default when g:WebDevIconsUnicodeDecorateFolderNodes is set to 1) 257 | ```vim 258 | let WebDevIconsUnicodeDecorateFolderNodesExactMatches = 1 259 | ``` 260 | 261 | * change the default folder/directory glyph/icon 262 | ```vim 263 | let g:WebDevIconsUnicodeDecorateFolderNodeDefaultSymbol = 'ƛ' 264 | ``` 265 | 266 | * change the default dictionary mappings for file extension matches 267 | ```vim 268 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} " needed 269 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['js'] = 'ƛ' 270 | ``` 271 | 272 | * change the default dictionary mappings for exact file node matches 273 | ```vim 274 | let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols = {} " needed 275 | let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols['MyReallyCoolFile.okay'] = 'ƛ' 276 | ``` 277 | 278 | * add or override individual additional filetypes 279 | ```vim 280 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} " needed 281 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['myext'] = 'ƛ' 282 | ``` 283 | 284 | ## Installation 285 | 286 | * [Sample Windows vimrc configuration 1](https://github.com/ryanoasis/vim-webdevicons/wiki/samples/v0.4.3/.vimrc-windows-1) 287 | * [Sample Linux vimrc configuration 1](https://github.com/ryanoasis/vim-webdevicons/wiki/samples/v0.4.3/.vimrc-linux-1) 288 | 289 | This plugin follows the standard runtime path structure, and as such it can be installed with a variety of plugin managers: 290 | 291 | * [Pathogen](https://github.com/tpope/vim-pathogen) 292 | * `git clone https://github.com/ryanoasis/vim-webdevicons ~/.vim/bundle/vim-webdevicons` 293 | * [NeoBundle](https://github.com/Shougo/neobundle.vim) 294 | * Add to vimrc: 295 | 296 | ```vim 297 | NeoBundle 'ryanoasis/vim-webdevicons' 298 | ``` 299 | * And install it: 300 | 301 | ```vim 302 | :so ~/.vimrc 303 | :NeoBundleInstall 304 | ``` 305 | 306 | * [Vundle](https://github.com/gmarik/vundle) 307 | * Add to vimrc: 308 | 309 | ```vim 310 | Plugin 'ryanoasis/vim-webdevicons' 311 | ``` 312 | * And install it: 313 | 314 | ```vim 315 | :so ~/.vimrc 316 | :PluginInstall` 317 | ``` 318 | 319 | * manual 320 | * copy all of the files into your `~/.vim` directory 321 | 322 | ## Lightline 323 | 324 | To add the appropriate icon to [lightline](https://github.com/itchyny/lightline.vim), call the function `WebDevIconsGetFileTypeSymbol()` and/or `WebDevIconsGetFileFormatSymbol()` in your `.vimrc`. For example, you could set your sections to: 325 | 326 | ```vim 327 | let g:lightline = { 328 | \ 'component_function': { 329 | \ 'filetype': 'MyFiletype', 330 | \ 'fileformat': 'MyFileformat', 331 | \ } 332 | \ } 333 | 334 | function! MyFiletype() 335 | return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : '' 336 | endfunction 337 | 338 | function! MyFileformat() 339 | return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : '' 340 | endfunction 341 | ``` 342 | 343 | ## Todo 344 | 345 | * [ ] more filetypes to support 346 | * [x] ~~make sure it works properly and does not conflict with [nerdtree-git-plugin]~~ 347 | * [ ] customize filetype icon colors 348 | * [ ] more customization options in general 349 | * [ ] more specific FAQ and Troubleshooting help 350 | 351 | ## FAQ / Troubleshooting 352 | 353 | * I don't want to use any of the fonts provided, I want to use font ABC 354 | * try the font patcher: [nerd-filetype-glyphs-fonts-patcher] 355 | * see font configuration above for more details 356 | 357 | * It isn't working 358 | * Are you using the patched font provided in the separate repo ([nerd-filetype-glyphs-fonts-patcher]) or are you patching your own? 359 | * _NOTE:_ if running vim and no font set it will default to the terminal font that is set 360 | * check what the vim/gvim font is set to, from ex mode: 361 | 362 | ```vim 363 | :set guifont? 364 | ``` 365 | 366 | * check if the plugin is loaded (should give '1'), from ex mode: 367 | 368 | ```vim 369 | :echo loaded_webdevicons 370 | ``` 371 | 372 | * check if the plugin is enabled (should give '1'), from ex mode: 373 | 374 | ```vim 375 | :echo g:webdevicons_enable 376 | ``` 377 | 378 | * check if the plugin is enabled for NERDTree (should give '1'), from ex mode: 379 | * this should *NOT* need to be set under normal circumstances 380 | 381 | ```vim 382 | :echo g:webdevicons_enable_nerdtree 383 | ``` 384 | 385 | * check if you are able to see the characters, from ex mode: 386 | 387 | ```vim 388 | :echo g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol 389 | ``` 390 | 391 | * if all this looks correct you may try this to see if any files show flags 392 | * last resort, see if you can even set the default symbol and have it display anywhere (NERDTree, vim-airline's statusline, vim-airlines's tabline), from ex mode: 393 | 394 | ```vim 395 | :let g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol='x' 396 | ``` 397 | 398 | * How did you get color matching based on file type in nerdtree? 399 | * my current settings are from: https://github.com/scrooloose/nerdtree/issues/201#issuecomment-9954740 400 | 401 | ```vim 402 | " NERDTress File highlighting 403 | function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg) 404 | exec 'autocmd FileType nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg 405 | exec 'autocmd FileType nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#' 406 | endfunction 407 | 408 | call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515') 409 | call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515') 410 | call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515') 411 | call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515') 412 | call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515') 413 | call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515') 414 | call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515') 415 | call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515') 416 | call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515') 417 | call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515') 418 | call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515') 419 | call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515') 420 | call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515') 421 | ``` 422 | Note: If the colors still are not highlighting, try invoking such as: 423 | ``` 424 | autocmd VimEnter * call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515') 425 | ``` 426 | per: https://github.com/ryanoasis/vim-webdevicons/issues/49#issuecomment-101753558 427 | 428 | ## Contributing 429 | 430 | Best ways to contribute 431 | * Star it on GitHub - if you use it and like it please at least star it :) 432 | * [Promote](#promotion) 433 | * Open [issues/tickets](https://github.com/ryanoasis/vim-webdevicons/issues) 434 | * Submit fixes and/or improvements with [Pull Requests](#source-code) 435 | 436 | ### Promotion 437 | 438 | Like the project? Please support to ensure continued development going forward: 439 | * Star this repo on [GitHub][vim-webdevicons-repo] 440 | * Follow the repo on [GitHub][vim-webdevicons-repo] 441 | * Vote for it on [vim.org](http://www.vim.org/scripts/script.php?script_id=5114) 442 | * Follow me 443 | * [Twitter](http://twitter.com/ryanlmcintyre) 444 | * [GitHub](https://github.com/ryanoasis) 445 | 446 | ### Source code 447 | 448 | Contributions and pull requests are welcome. 449 | 450 | No real formal process has been setup - just stick to general good conventions 451 | for now. 452 | 453 | ## Rationale 454 | 455 | After seeing the awesome theme for Atom (seti-ui) and the awesome plugins work done for NERDTree and vim-airline and wanting something like this for Vim I decided to create my first plugin. 456 | 457 | ## Inspiration and special thanks 458 | 459 | * [vim-airline] 460 | * [nerdtree] 461 | * [nerdtree-git-plugin] 462 | * [seti-ui](https://atom.io/themes/seti-ui) 463 | * [devicons by Theodore Vorillas](http://vorillaz.github.io/devicons) 464 | * [benatespina development.svg.icons](https://github.com/benatespina/development.svg.icons) 465 | * [Steve Losh](http://learnvimscriptthehardway.stevelosh.com/) 466 | 467 | ### Also thanks to the many contributors: 468 | * [contributors list](https://github.com/ryanoasis/vim-webdevicons/graphs/contributors) 469 | 470 | ## License 471 | 472 | See [LICENSE](LICENSE) 473 | 474 | 477 | 478 | [nerd-filetype-glyphs-fonts-patcher]:https://github.com/ryanoasis/nerd-filetype-glyphs-fonts-patcher 479 | [font-nerd-icons-patched-fonts]:https://github.com/ryanoasis/nerd-filetype-glyphs-fonts-patcher/tree/master/patched-fonts 480 | [NERDTree]:https://github.com/scrooloose/nerdtree 481 | [vim-airline]:https://github.com/bling/vim-airline 482 | [lightline.vim]:https://github.com/itchyny/lightline.vim 483 | [lightline]:https://github.com/itchyny/lightline.vim 484 | [nerdtree-git-plugin]:https://github.com/Xuyuanp/nerdtree-git-plugin 485 | 486 | [vim-webdevicons-repo]:https://github.com/ryanoasis/vim-webdevicons 487 | [badge-version]:http://badge.fury.io/gh/ryanoasis%2Fvim-webdevicons 488 | [badge-gitter]:https://gitter.im/ryanoasis/vim-webdevicons?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge 489 | [badge-flattr]:https://flattr.com/submit/auto?user_id=ryanoasis&url=https://github.com/ryanoasis/vim-webdevicons&title=vim-webdevicons&language=viml&tags=github&category=software 490 | -------------------------------------------------------------------------------- /doc/webdevicons.txt: -------------------------------------------------------------------------------- 1 | *readme.txt* vim-webdevicons v0.4.3 2 | 3 | =============================================================================== 4 | Contents ~ 5 | 6 | 1. Introduction |readme-introduction| 7 | 2. Usage |readme-usage| 8 | 3. Quick Setup (TL;DR) |readme-quick-setup| 9 | 4. Font Configuration |readme-font-configuration| 10 | 5. Font Installation |readme-font-installation| 11 | 6. Screenshots |readme-screenshots| 12 | 1. Various Terminal Emulators |readme-various-terminal-emulators| 13 | 2. Windows OS |readme-windows-os| 14 | 3. Mac OS X |readme-mac-os-x| 15 | 4. nerdtree-git-plugin |readme-nerdtree-git-plugin| 16 | 7. Features |readme-features| 17 | 8. Extra Configuration |readme-extra-configuration| 18 | 1. character mappings |readme-character-mappings| 19 | 9. Installation |readme-installation| 20 | 10. Lightline |readme-lightline| 21 | 11. Todo |readme-todo| 22 | 12. FAQ / Troubleshooting |readme-faq-troubleshooting| 23 | 13. Contributing |readme-contributing| 24 | 1. Promotion |readme-promotion| 25 | 2. Source code |readme-source-code| 26 | 14. Rationale |readme-rationale| 27 | 15. Inspiration and special thanks |readme-inspiration-special-thanks| 28 | 1. Also thanks to the many contributors: |readme-also-thanks-to-many-contributors| 29 | 16. License |readme-license| 30 | 17. References |readme-references| 31 | 32 | =============================================================================== 33 | *readme-introduction* 34 | Introduction ~ 35 | 36 | Adds filetype glyphs (icons) to other vim plugins such as NERDTree [1], vim- 37 | airline [2], and lightline.vim [3] 38 | 39 | Image: image (see reference [4]) 40 | 41 | - vim-webdevicons v0.4.3 42 | 43 | - Usage 44 | - Quick Setup (TL;DR) 45 | - Font Configuration 46 | - Font Installation 47 | - Screenshots 48 | - Features 49 | - Extra Configuration 50 | 51 | - character mappings 52 | 53 | - Installation 54 | - Lightline 55 | - Todo 56 | - FAQ / Troubleshooting 57 | - Contributing 58 | - Rationale 59 | - Inspiration and special thanks 60 | - License 61 | 62 | =============================================================================== 63 | *readme-usage* 64 | Usage ~ 65 | 66 | After installing the patched font and setting the vim font just open NERDTree 67 | [1] or look at vim-airline [2] (statusline or tabline). 68 | 69 | - _NOTE:_ if you don't have a vim font set and are not running gvim you will 70 | need to set the terminal font. 71 | 72 | - _NOTE:_ for NERDTree [1] support, you **must** configure vim to load 73 | NERDTree _before_ vim-webdevicons loads. 74 | 75 | - _NOTE:_ for vim-airline [2] support, you **must** configure vim to load 76 | vim-airline _before_ vim-webdevicons loads. 77 | 78 | - _NOTE:_ for better nerdtree-git-plugin [5] support, you _should_ configure 79 | vim to load nerdtree-git-plugin _before_ vim-webdevicons loads. 80 | 81 | =============================================================================== 82 | *readme-quick-setup* 83 | Quick Setup (TL;DR) ~ 84 | 85 | 1. Install the plugin per your usual method _More details..._ 86 | 2. Download and install a patched font (or patch your own) from: ryanoasis 87 | /nerd-filetype-glyphs-fonts-patcher [6]_More details..._ 88 | 3. Set font _More details..._ 89 | 4. a. If using 'vim': Set terminal font 90 | 5. b. If using 'gvim': Set 'guifont' in 'vimrc' 91 | 92 | =============================================================================== 93 | *readme-font-configuration* 94 | Font Configuration ~ 95 | 96 | - Encoding **must** be set to UTF-8 for the glyphs to show 'vim set 97 | encoding=utf8' 98 | 99 | - The _ONLY_ configuration needed should be setting the font vim uses to a 100 | patched font. 101 | 102 | Already patched fonts and the font patcher script are provided at: nerd- 103 | filetype-glyphs-fonts-patcher [6] 104 | 105 | It works without configuration _ONLY_ when used with a patched font provided in 106 | the separate repository above. Install the font and add it to your 'vimrc' or 107 | 'gvimrc': 108 | 109 | Linux 'vim set guifont= ' 110 | 111 | OS X and Windows 'vim set guifont=:h' 112 | 113 | e.g. 114 | 115 | Linux 116 | > 117 | set guifont=Droid\ Sans\ Mono\ for\ Powerline\ Plus\ Nerd\ File\ Types\ 11 118 | < 119 | OS X and Windows 120 | > 121 | set guifont=Droid\ Sans\ Mono\ for\ Powerline\ Plus\ Nerd\ File\ Types:h11 122 | < 123 | =============================================================================== 124 | *readme-font-installation* 125 | Font Installation ~ 126 | 127 | You basically have to put any font you would like to use into the '~/.fonts' 128 | folder. For example: 129 | > 130 | cd ~/.fonts && curl -fLo DroidSansMonoForPowerlinePlusNerdFileTypes.otf https://raw.githubusercontent.com/ryanoasis/nerd-filetype-glyphs-fonts-patcher/master/patched-fonts/Droid%20Sans%20Mono%20for%20Powerline%20Plus%20Nerd%20File%20Types.otf 131 | < 132 | You can find more fonts under my repository nerd-filetype-glyphs-fonts-patcher 133 | [7]. 134 | 135 | =============================================================================== 136 | *readme-screenshots* 137 | Screenshots ~ 138 | 139 | Image: image (see reference [8]) 140 | 141 | - NERDTree: 142 | 143 | Image: image (see reference [9]) 144 | 145 | - vim-airline 146 | - statusline Image: image (see reference [10]) 147 | - tabline Image: image (see reference [11])Image: image (see reference [12]) 148 | - fileformats symbols Image: image (see reference [13]) 149 | 150 | - Different patched fonts example: 151 | 152 | Image: image (see reference [14]) 153 | 154 | - Glyph set test file 155 | 156 | Image: image (see reference [15]) 157 | 158 | - Lightline: 159 | 160 | Image: image (see reference [16]) 161 | 162 | ------------------------------------------------------------------------------- 163 | *readme-various-terminal-emulators* 164 | Various Terminal Emulators ~ 165 | 166 | - gnome terminal 167 | 168 | Image: image (see reference [17]) 169 | 170 | - Urxvt terminal 171 | 172 | Image: image (see reference [18]) 173 | 174 | ------------------------------------------------------------------------------- 175 | *readme-windows-os* 176 | Windows OS ~ 177 | 178 | Image: image (see reference [19]) 179 | 180 | ------------------------------------------------------------------------------- 181 | *readme-mac-os-x* 182 | Mac OS X ~ 183 | 184 | help wanted: https://github.com/ryanoasis/vim-webdevicons/issues/32 185 | 186 | ------------------------------------------------------------------------------- 187 | *readme-nerdtree-git-plugin* 188 | nerdtree-git-plugin ~ 189 | 190 | Image: image (see reference [20]) 191 | 192 | =============================================================================== 193 | *readme-features* 194 | Features ~ 195 | 196 | - show developer file type glyphs from a font in various vim plugins, 197 | currently supports: 198 | - NERDTree [1] 199 | - vim-airline [2] (statusline and tabline) 200 | - lightline.vim [3] (statusline) 201 | 202 | - see: Lightline for setup 203 | 204 | - Adds a global config map of characters to file extensions (or entire 205 | filenames) 206 | - customizable and extendable filetype detections 207 | - ability to override predefined dictionary variable 208 | - if you are unhappy with the default glyph used you can choose your own 209 | - supports a range of file type extensions by default: 210 | - 'styl, scss, htm, html, css, less, md, json, js, rb, php, py, pyc, pyd, 211 | pyo, coffee, mustache, hbs, conf, ini, yml, jpg, jpeg, bmp, png, gif, ai, 212 | twig, cpp, c++, cc, cp, cxx, cpp, c, hs, lhs, lua, sh, diff, clj, dart, db, 213 | go, scala, sln, suo, xul' 214 | - supports full filename matches, by default: 215 | - 'gruntfile.coffee, gruntfile.js, gruntfile.ls, gulpfile.coffee, 216 | gulpfile.js, gulpfile.ls, dropbox' 217 | - font patcher (nerd-filetype-glyphs-fonts-patcher [6]) 218 | - requires: python2, python-fontforge package 219 | - example usage > ./font-patcher unpatched-sample-fonts/Droid\ Sans\ Mono\ 220 | for\ Powerline.otf 221 | 222 | =============================================================================== 223 | *readme-extra-configuration* 224 | Extra Configuration ~ 225 | 226 | - by default you should not _NEED_ to configure anything to get the basics 227 | working 228 | 229 | - _NOTE:_ You _NEED_ to use one of the patched font provided or patch your 230 | own (nerd-filetype-glyphs-fonts-patcher [6]) _unless_ you want to configure 231 | the filetype to glyph mappings yourself for your current font 232 | 233 | - these options can be defined in your 'vimrc' or 'gvimrc' 234 | 235 | - the following options are provided however for overriding 236 | 237 | - enable/disable loading the plugin (default 1) 'vim let g:webdevicons_enable 238 | = 1' 239 | 240 | - enable/disable adding the flags to NERDTree (default 1) 'vim let 241 | g:webdevicons_enable_nerdtree = 1' 242 | 243 | - enable/disable adding to vim-airline's tabline (default 1) 'vim let 244 | g:webdevicons_enable_airline_tabline = 1' 245 | 246 | - enable/disable adding to vim-airline's statusline (default 1) 'vim let 247 | g:webdevicons_enable_airline_statusline = 1' 248 | 249 | - turn on/off file node glyph decorations (not particularly useful) 'vim let 250 | g:WebDevIconsUnicodeDecorateFileNodes = 1' 251 | 252 | - whether or not font is using double-width glyphs (default 1, set to 0 for 253 | single character width glyphs) 254 | 255 | - _note:_ does not actually switch the font or try to use the correct 256 | font, just adds a space to account for a double width glyph, you have 257 | to set the correct double width glyph font in your terminal or 258 | 'guifont''vim let g:WebDevIconsUnicodeGlyphDoubleWidth = 1' 259 | 260 | - whether or not to show the nerdtree brackets around flags (default 1) 261 | > 262 | let g:webdevicons_conceal_nerdtree_brackets = 1 263 | < 264 | - the amount of space to use after the glyph character (default ' ') 265 | > 266 | let g:WebDevIconsNerdTreeAfterGlyphPadding = ' ' 267 | < 268 | ------------------------------------------------------------------------------- 269 | *readme-character-mappings* 270 | character mappings ~ 271 | 272 | - 'ƛ' is used as an example below, substitute for the glyph you **actually** 273 | want to use 274 | 275 | - change the default character when no match found "vim let 276 | g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol = 'ƛ'" 277 | 278 | - enable folder/directory glyph flag (disabled by default with 0) 'vim let 279 | g:WebDevIconsUnicodeDecorateFolderNodes = 1' 280 | 281 | - enable custom folder/directory glyph exact matching (enabled by default 282 | when g:WebDevIconsUnicodeDecorateFolderNodes is set to 1) 'vim let 283 | WebDevIconsUnicodeDecorateFolderNodesExactMatches = 1' 284 | 285 | - change the default folder/directory glyph/icon "vim let 286 | g:WebDevIconsUnicodeDecorateFolderNodeDefaultSymbol = 'ƛ'" 287 | 288 | - change the default dictionary mappings for file extension matches "vim let 289 | g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} " needed let 290 | g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['js'] = 'ƛ'" 291 | 292 | - change the default dictionary mappings for exact file node matches "vim let 293 | g:WebDevIconsUnicodeDecorateFileNodesExactSymbols = {} " needed let 294 | g:WebDevIconsUnicodeDecorateFileNodesExactSymbols['MyReallyCoolFile.okay'] 295 | = 'ƛ'" 296 | 297 | - add or override individual additional filetypes "vim let 298 | g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} " needed let 299 | g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['myext'] = 'ƛ'" 300 | 301 | =============================================================================== 302 | *readme-installation* 303 | Installation ~ 304 | 305 | - Sample Windows vimrc configuration 1 [21] 306 | - Sample Linux vimrc configuration 1 [22] 307 | 308 | This plugin follows the standard runtime path structure, and as such it can be 309 | installed with a variety of plugin managers: 310 | 311 | - Pathogen [23] 312 | - 'git clone https://github.com/ryanoasis/vim-webdevicons ~/.vim/bundle/vim- 313 | webdevicons' 314 | - NeoBundle [24] 315 | - Add to vimrc: 316 | 317 | "vim NeoBundle 'ryanoasis/vim-webdevicons'" * And install it: 318 | 319 | 'vim :so ~/.vimrc :NeoBundleInstall' 320 | 321 | - Vundle [25] 322 | 323 | - Add to vimrc: 324 | 325 | "vim Plugin 'ryanoasis/vim-webdevicons'" * And install it: 326 | 327 | 'vim :so ~/.vimrc :PluginInstall`' 328 | 329 | - manual 330 | 331 | - copy all of the files into your '~/.vim' directory 332 | 333 | =============================================================================== 334 | *readme-lightline* 335 | Lightline ~ 336 | 337 | To add the appropriate icon to lightline [3], call the function 338 | 'WebDevIconsGetFileTypeSymbol()' and/or 'WebDevIconsGetFileFormatSymbol()' in 339 | your '.vimrc'. For example, you could set your sections to: 340 | > 341 | let g:lightline = { 342 | \ 'component_function': { 343 | \ 'filetype': 'MyFiletype', 344 | \ 'fileformat': 'MyFileformat', 345 | \ } 346 | \ } 347 | 348 | function! MyFiletype() 349 | return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : '' 350 | endfunction 351 | 352 | function! MyFileformat() 353 | return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : '' 354 | endfunction 355 | < 356 | =============================================================================== 357 | *readme-todo* 358 | Todo ~ 359 | 360 | - [ ] more filetypes to support 361 | - [x] make sure it works properly and does not conflict with nerdtree-git- 362 | plugin [5] 363 | - [ ] customize filetype icon colors 364 | - [ ] more customization options in general 365 | 366 | =============================================================================== 367 | *readme-faq-troubleshooting* 368 | FAQ / Troubleshooting ~ 369 | 370 | - I don't want to use any of the fonts provided, I want to use font ABC 371 | 372 | - try the font patcher: nerd-filetype-glyphs-fonts-patcher [6] 373 | 374 | - see font configuration above for more details 375 | 376 | - It isn't working 377 | 378 | - Are you using the patched font provided in the separate repo (nerd- 379 | filetype-glyphs-fonts-patcher [6]) or are you patching your own? 380 | 381 | - _NOTE:_ if running vim and no font set it will default to the terminal font 382 | that is set 383 | 384 | - check what the vim/gvim font is set to, from ex mode: 385 | 386 | 'vim :set guifont?' 387 | 388 | - check if the plugin is loaded (should give '1'), from ex mode: 389 | 390 | 'vim :echo loaded_webdevicons' 391 | 392 | - check if the plugin is enabled (should give '1'), from ex mode: 393 | 394 | 'vim :echo g:webdevicons_enable' 395 | 396 | - check if the plugin is enabled for NERDTree (should give '1'), from ex 397 | mode: 398 | 399 | - this should _NOT_ need to be set under normal circumstances 400 | 401 | 'vim :echo g:webdevicons_enable_nerdtree' 402 | 403 | - check if you are able to see the characters, from ex mode: 404 | 405 | 'vim :echo g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol' 406 | 407 | - if all this looks correct you may try this to see if any files show flags 408 | 409 | - last resort, see if you can even set the default symbol and have it 410 | display anywhere (NERDTree, vim-airline's statusline, vim-airlines's 411 | tabline), from ex mode: 412 | 413 | "vim :let g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol='x'" 414 | 415 | - How did you get color matching based on file type in nerdtree? 416 | 417 | - my current settings added on orignally from: 418 | https://github.com/scrooloose/nerdtree/issues/201#issuecomment-9954740 419 | 420 | ```vim " NERDTress File highlighting function! 421 | NERDTreeHighlightFile(extension, fg, bg, guifg, guibg) exec 'autocmd 422 | FileType nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' 423 | ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg exec 'autocmd 424 | FileType nerdtree syn match ' . a:extension .' #^\s+.*'. a:extension .'$#' 425 | endfunction 426 | 427 | call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515') 428 | call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515') 429 | call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515') call 430 | NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515') call 431 | NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515') call 432 | NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515') call 433 | NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515') call 434 | NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515') call 435 | NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515') call 436 | NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515') call 437 | NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515') call 438 | NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515') call 439 | NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515') 440 | 'Note: If the colors still are not highlighting, try invoking such as:' 441 | autocmd VimEnter * call NERDTreeHighlightFile('jade', 'green', 'none', 442 | 'green', '#151515') ``` per: https://github.com/ryanoasis/vim- 443 | webdevicons/issues/49#issuecomment-101753558 444 | 445 | - @todo: more specific FAQ and Troubleshooting help 446 | 447 | =============================================================================== 448 | *readme-contributing* 449 | Contributing ~ 450 | 451 | Best ways to contribute _Star it on GitHub - if you use it and like it please 452 | at least star it :)_ Promote _Open issues/tickets [26]_ Submit fixes and/or 453 | improvements with Pull Requests 454 | 455 | ------------------------------------------------------------------------------- 456 | *readme-promotion* 457 | Promotion ~ 458 | 459 | Like the project? Please support to ensure continued development going forward: 460 | _Star this repo on GitHub [27]_ Follow the repo on GitHub [27] _Vote for it on 461 | vim.org [28]_ Follow me **Twitter [29]** GitHub [30] 462 | 463 | ------------------------------------------------------------------------------- 464 | *readme-source-code* 465 | Source code ~ 466 | 467 | Contributions and pull requests are welcome. 468 | 469 | No real formal process has been setup - just stick to general good conventions 470 | for now. 471 | 472 | =============================================================================== 473 | *readme-rationale* 474 | Rationale ~ 475 | 476 | After seeing the awesome theme for Atom (seti-ui) and the awesome plugins work 477 | done for NERDTree and vim-airline and wanting something like this for Vim I 478 | decided to create my first plugin. 479 | 480 | =============================================================================== 481 | *readme-inspiration-special-thanks* 482 | Inspiration and special thanks ~ 483 | 484 | - vim-airline [2] 485 | - nerdtree [1] 486 | - nerdtree-git-plugin [5] 487 | - seti-ui [31] 488 | - devicons by Theodore Vorillas [32] 489 | - benatespina development.svg.icons [33] 490 | - Steve Losh [34] 491 | 492 | ------------------------------------------------------------------------------- 493 | *readme-also-thanks-to-many-contributors* 494 | Also thanks to the many contributors: ~ 495 | 496 | - contributors list [35] 497 | 498 | =============================================================================== 499 | *readme-license* 500 | License ~ 501 | 502 | see LICENSE 503 | 504 | =============================================================================== 505 | *readme-references* 506 | References ~ 507 | 508 | [1] https://github.com/scrooloose/nerdtree 509 | [2] https://github.com/bling/vim-airline 510 | [3] https://github.com/itchyny/lightline.vim 511 | [4] https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.4.3/overall-screenshot.png 512 | [5] https://github.com/Xuyuanp/nerdtree-git-plugin 513 | [6] https://github.com/ryanoasis/nerd-filetype-glyphs-fonts-patcher 514 | [7] https://github.com/ryanoasis/nerd-filetype-glyphs-fonts-patcher/tree/master/patched-fonts 515 | [8] https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.4.3/vim.png 516 | [9] https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.4.3/nerdtree.png 517 | [10] https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.4.3/airline-statusline.png 518 | [11] https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.4.3/airline-tabline-1.png 519 | [12] https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.4.3/airline-tabline-2.png 520 | [13] https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.4.3/fileformats-symbols-sample.png 521 | [14] https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.4.3/different-fonts-sample.png 522 | [15] https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.4.3/glyph-set-test.png 523 | [16] https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.4.3/lightline.png 524 | [17] https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.4.3/terminal-gnome-sample.png 525 | [18] https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.4.3/terminal-urxvt-sample.png 526 | [19] https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.4.3/windows-sample.png 527 | [20] https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.4.3/nerdtree-git-plugin-sample.png 528 | [21] https://github.com/ryanoasis/vim-webdevicons/wiki/samples/v0.4.3/.vimrc-windows-1 529 | [22] https://github.com/ryanoasis/vim-webdevicons/wiki/samples/v0.4.3/.vimrc-linux-1 530 | [23] https://github.com/tpope/vim-pathogen 531 | [24] https://github.com/Shougo/neobundle.vim 532 | [25] https://github.com/gmarik/vundle 533 | [26] https://github.com/ryanoasis/vim-webdevicons/issues 534 | [27] https://github.com/ryanoasis/vim-webdevicons 535 | [28] http://www.vim.org/scripts/script.php?script_id=5114 536 | [29] http://twitter.com/ryanlmcintyre 537 | [30] https://github.com/ryanoasis 538 | [31] https://atom.io/themes/seti-ui 539 | [32] http://vorillaz.github.io/devicons 540 | [33] https://github.com/benatespina/development.svg.icons 541 | [34] http://learnvimscriptthehardway.stevelosh.com/ 542 | [35] https://github.com/ryanoasis/vim-webdevicons/network/members 543 | 544 | vim: ft=help 545 | --------------------------------------------------------------------------------