diff options
| author | Sam Chudnick <sam@chudnick.com> | 2023-06-11 07:54:59 -0400 |
|---|---|---|
| committer | Sam Chudnick <sam@chudnick.com> | 2023-06-11 07:54:59 -0400 |
| commit | 3adcf542289a0883924ae9b9be8b898c36702c95 (patch) | |
| tree | f02166ef4c95161ffa994eb1a3e5729c93c2c66b /.vim/pack/vendor/start/vim-devicons/plugin | |
| parent | dfcc303e7cc284a45f55bae81ed888dc256432b8 (diff) | |
Add some Vim plugins
Diffstat (limited to '.vim/pack/vendor/start/vim-devicons/plugin')
| -rw-r--r-- | .vim/pack/vendor/start/vim-devicons/plugin/webdevicons.vim | 703 |
1 files changed, 703 insertions, 0 deletions
diff --git a/.vim/pack/vendor/start/vim-devicons/plugin/webdevicons.vim b/.vim/pack/vendor/start/vim-devicons/plugin/webdevicons.vim new file mode 100644 index 0000000..596ec68 --- /dev/null +++ b/.vim/pack/vendor/start/vim-devicons/plugin/webdevicons.vim | |||
| @@ -0,0 +1,703 @@ | |||
| 1 | " Version: 0.11.0 | ||
| 2 | " Webpage: https://github.com/ryanoasis/vim-devicons | ||
| 3 | " Maintainer: Ryan McIntyre <ryanoasis@gmail.com> | ||
| 4 | " License: see LICENSE | ||
| 5 | |||
| 6 | let s:version = '0.11.0' | ||
| 7 | let s:plugin_home = expand('<sfile>:p:h:h') | ||
| 8 | |||
| 9 | " set scriptencoding after 'encoding' and when using multibyte chars | ||
| 10 | scriptencoding utf-8 | ||
| 11 | |||
| 12 | " standard fix/safety: line continuation (avoiding side effects) {{{1 | ||
| 13 | "======================================================================== | ||
| 14 | let s:save_cpo = &cpo | ||
| 15 | set cpo&vim | ||
| 16 | |||
| 17 | " standard loading / not loading {{{1 | ||
| 18 | "======================================================================== | ||
| 19 | |||
| 20 | if exists('g:loaded_webdevicons') | ||
| 21 | finish | ||
| 22 | endif | ||
| 23 | |||
| 24 | let g:loaded_webdevicons = 1 | ||
| 25 | |||
| 26 | " config enable / disable settings {{{1 | ||
| 27 | "======================================================================== | ||
| 28 | |||
| 29 | "" | ||
| 30 | " Set the variable to the default value, only if variable is not defined. | ||
| 31 | " | ||
| 32 | " @param {string} var Variable name with its scope. | ||
| 33 | " @param {*} default Default value for variable. | ||
| 34 | "" | ||
| 35 | function! s:set(var, default) abort | ||
| 36 | if !exists(a:var) | ||
| 37 | if type(a:default) | ||
| 38 | execute 'let' a:var '=' string(a:default) | ||
| 39 | else | ||
| 40 | execute 'let' a:var '=' a:default | ||
| 41 | endif | ||
| 42 | endif | ||
| 43 | endfunction | ||
| 44 | |||
| 45 | call s:set('g:webdevicons_enable', 1) | ||
| 46 | call s:set('g:webdevicons_enable_nerdtree', 1) | ||
| 47 | call s:set('g:webdevicons_enable_unite ', 1) | ||
| 48 | call s:set('g:webdevicons_enable_denite', 1) | ||
| 49 | call s:set('g:webdevicons_enable_vimfiler', 1) | ||
| 50 | call s:set('g:webdevicons_enable_ctrlp', 1) | ||
| 51 | call s:set('g:webdevicons_enable_airline_tabline', 1) | ||
| 52 | call s:set('g:webdevicons_enable_airline_statusline', 1) | ||
| 53 | call s:set('g:webdevicons_enable_airline_statusline_fileformat_symbols', 1) | ||
| 54 | call s:set('g:webdevicons_enable_flagship_statusline', 1) | ||
| 55 | call s:set('g:webdevicons_enable_flagship_statusline_fileformat_symbols', 1) | ||
| 56 | call s:set('g:webdevicons_enable_startify', 1) | ||
| 57 | call s:set('g:webdevicons_conceal_nerdtree_brackets', 1) | ||
| 58 | call s:set('g:DevIconsAppendArtifactFix', has('gui_running') ? 1 : 0) | ||
| 59 | call s:set('g:DevIconsArtifactFixChar', ' ') | ||
| 60 | |||
| 61 | " config options {{{1 | ||
| 62 | "======================================================================== | ||
| 63 | |||
| 64 | call s:set('g:WebDevIconsUnicodeDecorateFileNodes', 1) | ||
| 65 | call s:set('g:WebDevIconsUnicodeDecorateFolderNodes', 1) | ||
| 66 | call s:set('g:DevIconsEnableFoldersOpenClose', 0) | ||
| 67 | call s:set('g:DevIconsEnableFolderPatternMatching', 1) | ||
| 68 | call s:set('g:DevIconsEnableFolderExtensionPatternMatching', 0) | ||
| 69 | call s:set('g:DevIconsEnableDistro', 1) | ||
| 70 | call s:set('g:WebDevIconsUnicodeDecorateFolderNodesExactMatches', 1) | ||
| 71 | call s:set('g:WebDevIconsUnicodeGlyphDoubleWidth', 1) | ||
| 72 | call s:set('g:WebDevIconsNerdTreeBeforeGlyphPadding', ' ') | ||
| 73 | call s:set('g:WebDevIconsNerdTreeAfterGlyphPadding', ' ') | ||
| 74 | call s:set('g:WebDevIconsNerdTreeGitPluginForceVAlign', 1) | ||
| 75 | call s:set('g:NERDTreeUpdateOnCursorHold', 1) " Obsolete: For backward compatibility | ||
| 76 | call s:set('g:NERDTreeGitStatusUpdateOnCursorHold', 1) | ||
| 77 | call s:set('g:WebDevIconsTabAirLineBeforeGlyphPadding', ' ') | ||
| 78 | call s:set('g:WebDevIconsTabAirLineAfterGlyphPadding', '') | ||
| 79 | |||
| 80 | " config defaults {{{1 | ||
| 81 | "======================================================================== | ||
| 82 | |||
| 83 | call s:set('g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol', '') | ||
| 84 | call s:set('g:WebDevIconsUnicodeByteOrderMarkerDefaultSymbol', '') | ||
| 85 | call s:set('g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol', g:DevIconsEnableFoldersOpenClose ? '' : '') | ||
| 86 | call s:set('g:WebDevIconsUnicodeDecorateFolderNodesSymlinkSymbol', '') | ||
| 87 | call s:set('g:DevIconsDefaultFolderOpenSymbol', '') | ||
| 88 | |||
| 89 | " functions {{{1 | ||
| 90 | "======================================================================== | ||
| 91 | |||
| 92 | " local functions {{{2 | ||
| 93 | "======================================================================== | ||
| 94 | |||
| 95 | " scope: local | ||
| 96 | function s:getDistro() | ||
| 97 | if exists('s:distro') | ||
| 98 | return s:distro | ||
| 99 | endif | ||
| 100 | |||
| 101 | if has('bsd') | ||
| 102 | let s:distro = '' | ||
| 103 | return s:distro | ||
| 104 | endif | ||
| 105 | |||
| 106 | if g:DevIconsEnableDistro && executable('lsb_release') | ||
| 107 | let s:lsb = system('lsb_release -i') | ||
| 108 | if s:lsb =~# 'Arch' | ||
| 109 | let s:distro = '' | ||
| 110 | elseif s:lsb =~# 'Gentoo' | ||
| 111 | let s:distro = '' | ||
| 112 | elseif s:lsb =~# 'Ubuntu' | ||
| 113 | let s:distro = '' | ||
| 114 | elseif s:lsb =~# 'Cent' | ||
| 115 | let s:distro = '' | ||
| 116 | elseif s:lsb =~# 'Debian' | ||
| 117 | let s:distro = '' | ||
| 118 | elseif s:lsb =~# 'Dock' | ||
| 119 | let s:distro = '' | ||
| 120 | else | ||
| 121 | let s:distro = '' | ||
| 122 | endif | ||
| 123 | return s:distro | ||
| 124 | endif | ||
| 125 | |||
| 126 | let s:distro = '' | ||
| 127 | return s:distro | ||
| 128 | endfunction | ||
| 129 | |||
| 130 | " scope: local | ||
| 131 | function s:isDarwin() | ||
| 132 | if exists('s:is_darwin') | ||
| 133 | return s:is_darwin | ||
| 134 | endif | ||
| 135 | |||
| 136 | if exists('g:WebDevIconsOS') | ||
| 137 | let s:is_darwin = g:WebDevIconsOS ==? 'Darwin' | ||
| 138 | return s:is_darwin | ||
| 139 | endif | ||
| 140 | |||
| 141 | if has('macunix') | ||
| 142 | let s:is_darwin = 1 | ||
| 143 | return s:is_darwin | ||
| 144 | endif | ||
| 145 | |||
| 146 | if ! has('unix') | ||
| 147 | let s:is_darwin = 0 | ||
| 148 | return s:is_darwin | ||
| 149 | endif | ||
| 150 | |||
| 151 | if system('uname -s') ==# "Darwin\n" | ||
| 152 | let s:is_darwin = 1 | ||
| 153 | else | ||
| 154 | let s:is_darwin = 0 | ||
| 155 | endif | ||
| 156 | |||
| 157 | return s:is_darwin | ||
| 158 | endfunction | ||
| 159 | |||
| 160 | " scope: local | ||
| 161 | function! s:strip(input) | ||
| 162 | return substitute(a:input, '^\s*\(.\{-}\)\s*$', '\1', '') | ||
| 163 | endfunction | ||
| 164 | |||
| 165 | " scope: local | ||
| 166 | function! s:setDictionaries() | ||
| 167 | |||
| 168 | let s:file_node_extensions = { | ||
| 169 | \ 'styl' : '', | ||
| 170 | \ 'sass' : '', | ||
| 171 | \ 'scss' : '', | ||
| 172 | \ 'htm' : '', | ||
| 173 | \ 'html' : '', | ||
| 174 | \ 'slim' : '', | ||
| 175 | \ 'haml' : '', | ||
| 176 | \ 'ejs' : '', | ||
| 177 | \ 'css' : '', | ||
| 178 | \ 'less' : '', | ||
| 179 | \ 'md' : '', | ||
| 180 | \ 'mdx' : '', | ||
| 181 | \ 'markdown' : '', | ||
| 182 | \ 'rmd' : '', | ||
| 183 | \ 'json' : '', | ||
| 184 | \ 'webmanifest' : '', | ||
| 185 | \ 'js' : '', | ||
| 186 | \ 'mjs' : '', | ||
| 187 | \ 'jsx' : '', | ||
| 188 | \ 'rb' : '', | ||
| 189 | \ 'gemspec' : '', | ||
| 190 | \ 'rake' : '', | ||
| 191 | \ 'php' : '', | ||
| 192 | \ 'py' : '', | ||
| 193 | \ 'pyc' : '', | ||
| 194 | \ 'pyo' : '', | ||
| 195 | \ 'pyd' : '', | ||
| 196 | \ 'coffee' : '', | ||
| 197 | \ 'mustache' : '', | ||
| 198 | \ 'hbs' : '', | ||
| 199 | \ 'conf' : '', | ||
| 200 | \ 'ini' : '', | ||
| 201 | \ 'yml' : '', | ||
| 202 | \ 'yaml' : '', | ||
| 203 | \ 'toml' : '', | ||
| 204 | \ 'bat' : '', | ||
| 205 | \ 'mk' : '', | ||
| 206 | \ 'jpg' : '', | ||
| 207 | \ 'jpeg' : '', | ||
| 208 | \ 'bmp' : '', | ||
| 209 | \ 'png' : '', | ||
| 210 | \ 'webp' : '', | ||
| 211 | \ 'gif' : '', | ||
| 212 | \ 'ico' : '', | ||
| 213 | \ 'twig' : '', | ||
| 214 | \ 'cpp' : '', | ||
| 215 | \ 'c++' : '', | ||
| 216 | \ 'cxx' : '', | ||
| 217 | \ 'cc' : '', | ||
| 218 | \ 'cp' : '', | ||
| 219 | \ 'c' : '', | ||
| 220 | \ 'cs' : '', | ||
| 221 | \ 'h' : '', | ||
| 222 | \ 'hh' : '', | ||
| 223 | \ 'hpp' : '', | ||
| 224 | \ 'hxx' : '', | ||
| 225 | \ 'hs' : '', | ||
| 226 | \ 'lhs' : '', | ||
| 227 | \ 'nix' : '', | ||
| 228 | \ 'lua' : '', | ||
| 229 | \ 'java' : '', | ||
| 230 | \ 'sh' : '', | ||
| 231 | \ 'fish' : '', | ||
| 232 | \ 'bash' : '', | ||
| 233 | \ 'zsh' : '', | ||
| 234 | \ 'ksh' : '', | ||
| 235 | \ 'csh' : '', | ||
| 236 | \ 'awk' : '', | ||
| 237 | \ 'ps1' : '', | ||
| 238 | \ 'ml' : 'λ', | ||
| 239 | \ 'mli' : 'λ', | ||
| 240 | \ 'diff' : '', | ||
| 241 | \ 'db' : '', | ||
| 242 | \ 'sql' : '', | ||
| 243 | \ 'dump' : '', | ||
| 244 | \ 'clj' : '', | ||
| 245 | \ 'cljc' : '', | ||
| 246 | \ 'cljs' : '', | ||
| 247 | \ 'edn' : '', | ||
| 248 | \ 'scala' : '', | ||
| 249 | \ 'go' : '', | ||
| 250 | \ 'dart' : '', | ||
| 251 | \ 'xul' : '', | ||
| 252 | \ 'sln' : '', | ||
| 253 | \ 'suo' : '', | ||
| 254 | \ 'pl' : '', | ||
| 255 | \ 'pm' : '', | ||
| 256 | \ 't' : '', | ||
| 257 | \ 'rss' : '', | ||
| 258 | \ 'f#' : '', | ||
| 259 | \ 'fsscript' : '', | ||
| 260 | \ 'fsx' : '', | ||
| 261 | \ 'fs' : '', | ||
| 262 | \ 'fsi' : '', | ||
| 263 | \ 'rs' : '', | ||
| 264 | \ 'rlib' : '', | ||
| 265 | \ 'd' : '', | ||
| 266 | \ 'erl' : '', | ||
| 267 | \ 'hrl' : '', | ||
| 268 | \ 'ex' : '', | ||
| 269 | \ 'exs' : '', | ||
| 270 | \ 'eex' : '', | ||
| 271 | \ 'leex' : '', | ||
| 272 | \ 'heex' : '', | ||
| 273 | \ 'vim' : '', | ||
| 274 | \ 'ai' : '', | ||
| 275 | \ 'psd' : '', | ||
| 276 | \ 'psb' : '', | ||
| 277 | \ 'ts' : '', | ||
| 278 | \ 'tsx' : '', | ||
| 279 | \ 'jl' : '', | ||
| 280 | \ 'pp' : '', | ||
| 281 | \ 'vue' : '﵂', | ||
| 282 | \ 'elm' : '', | ||
| 283 | \ 'swift' : '', | ||
| 284 | \ 'xcplayground' : '', | ||
| 285 | \ 'tex' : 'ﭨ', | ||
| 286 | \ 'r' : 'ﳒ', | ||
| 287 | \ 'rproj' : '鉶', | ||
| 288 | \ 'sol' : 'ﲹ', | ||
| 289 | \ 'pem' : '' | ||
| 290 | \} | ||
| 291 | |||
| 292 | let s:file_node_exact_matches = { | ||
| 293 | \ 'exact-match-case-sensitive-1.txt' : '1', | ||
| 294 | \ 'exact-match-case-sensitive-2' : '2', | ||
| 295 | \ 'gruntfile.coffee' : '', | ||
| 296 | \ 'gruntfile.js' : '', | ||
| 297 | \ 'gruntfile.ls' : '', | ||
| 298 | \ 'gulpfile.coffee' : '', | ||
| 299 | \ 'gulpfile.js' : '', | ||
| 300 | \ 'gulpfile.ls' : '', | ||
| 301 | \ 'mix.lock' : '', | ||
| 302 | \ 'dropbox' : '', | ||
| 303 | \ '.ds_store' : '', | ||
| 304 | \ '.gitconfig' : '', | ||
| 305 | \ '.gitignore' : '', | ||
| 306 | \ '.gitattributes' : '', | ||
| 307 | \ '.gitlab-ci.yml' : '', | ||
| 308 | \ '.bashrc' : '', | ||
| 309 | \ '.zshrc' : '', | ||
| 310 | \ '.zshenv' : '', | ||
| 311 | \ '.zprofile' : '', | ||
| 312 | \ '.vimrc' : '', | ||
| 313 | \ '.gvimrc' : '', | ||
| 314 | \ '_vimrc' : '', | ||
| 315 | \ '_gvimrc' : '', | ||
| 316 | \ '.bashprofile' : '', | ||
| 317 | \ 'favicon.ico' : '', | ||
| 318 | \ 'license' : '', | ||
| 319 | \ 'node_modules' : '', | ||
| 320 | \ 'react.jsx' : '', | ||
| 321 | \ 'procfile' : '', | ||
| 322 | \ 'dockerfile' : '', | ||
| 323 | \ 'docker-compose.yml' : '', | ||
| 324 | \ 'rakefile' : '', | ||
| 325 | \ 'config.ru' : '', | ||
| 326 | \ 'gemfile' : '', | ||
| 327 | \ 'makefile' : '', | ||
| 328 | \ 'cmakelists.txt' : '', | ||
| 329 | \ 'robots.txt' : 'ﮧ' | ||
| 330 | \} | ||
| 331 | |||
| 332 | let s:file_node_pattern_matches = { | ||
| 333 | \ '.*jquery.*\.js$' : '', | ||
| 334 | \ '.*angular.*\.js$' : '', | ||
| 335 | \ '.*backbone.*\.js$' : '', | ||
| 336 | \ '.*require.*\.js$' : '', | ||
| 337 | \ '.*materialize.*\.js$' : '', | ||
| 338 | \ '.*materialize.*\.css$' : '', | ||
| 339 | \ '.*mootools.*\.js$' : '', | ||
| 340 | \ '.*vimrc.*' : '', | ||
| 341 | \ 'Vagrantfile$' : '' | ||
| 342 | \} | ||
| 343 | |||
| 344 | if !exists('g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols') | ||
| 345 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} | ||
| 346 | endif | ||
| 347 | |||
| 348 | if !exists('g:WebDevIconsUnicodeDecorateFileNodesExactSymbols') | ||
| 349 | " do not remove: exact-match-case-sensitive-* | ||
| 350 | let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols = {} | ||
| 351 | endif | ||
| 352 | |||
| 353 | if !exists('g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols') | ||
| 354 | let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols = {} | ||
| 355 | endif | ||
| 356 | |||
| 357 | " iterate to fix allow user overriding of specific individual keys in vimrc (only gvimrc was working previously) | ||
| 358 | for [key, val] in items(s:file_node_extensions) | ||
| 359 | if !has_key(g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols, key) | ||
| 360 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols[key] = val | ||
| 361 | endif | ||
| 362 | endfor | ||
| 363 | |||
| 364 | " iterate to fix allow user overriding of specific individual keys in vimrc (only gvimrc was working previously) | ||
| 365 | for [key, val] in items(s:file_node_exact_matches) | ||
| 366 | if !has_key(g:WebDevIconsUnicodeDecorateFileNodesExactSymbols, key) | ||
| 367 | let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols[key] = val | ||
| 368 | endif | ||
| 369 | endfor | ||
| 370 | |||
| 371 | " iterate to fix allow user overriding of specific individual keys in vimrc (only gvimrc was working previously) | ||
| 372 | for [key, val] in items(s:file_node_pattern_matches) | ||
| 373 | if !has_key(g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols, key) | ||
| 374 | let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols[key] = val | ||
| 375 | endif | ||
| 376 | endfor | ||
| 377 | |||
| 378 | endfunction | ||
| 379 | |||
| 380 | " scope: local | ||
| 381 | function! s:setSyntax() | ||
| 382 | if g:webdevicons_enable_nerdtree == 1 && g:webdevicons_conceal_nerdtree_brackets == 1 | ||
| 383 | augroup webdevicons_conceal_nerdtree_brackets | ||
| 384 | au! | ||
| 385 | autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\]" contained conceal containedin=NERDTreeFlags | ||
| 386 | autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\[" contained conceal containedin=NERDTreeFlags | ||
| 387 | autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\]" contained conceal containedin=NERDTreeLinkFile | ||
| 388 | autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\]" contained conceal containedin=NERDTreeLinkDir | ||
| 389 | autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\[" contained conceal containedin=NERDTreeLinkFile | ||
| 390 | autocmd FileType nerdtree syntax match hideBracketsInNerdTree "\[" contained conceal containedin=NERDTreeLinkDir | ||
| 391 | autocmd FileType nerdtree setlocal conceallevel=3 | ||
| 392 | autocmd FileType nerdtree setlocal concealcursor=nvic | ||
| 393 | augroup END | ||
| 394 | endif | ||
| 395 | endfunction | ||
| 396 | |||
| 397 | " scope: local | ||
| 398 | " stole solution/idea from nerdtree-git-plugin :) | ||
| 399 | function! s:setCursorHold() | ||
| 400 | if g:webdevicons_enable_nerdtree | ||
| 401 | augroup webdevicons_cursor_hold | ||
| 402 | autocmd CursorHold * silent! call s:CursorHoldUpdate() | ||
| 403 | augroup END | ||
| 404 | endif | ||
| 405 | endfunction | ||
| 406 | |||
| 407 | " scope: local | ||
| 408 | " stole solution/idea from nerdtree-git-plugin :) | ||
| 409 | function! s:CursorHoldUpdate() | ||
| 410 | if g:NERDTreeUpdateOnCursorHold != 1 || g:NERDTreeGitStatusUpdateOnCursorHold != 1 | ||
| 411 | return | ||
| 412 | endif | ||
| 413 | |||
| 414 | if !exists('g:NERDTree') || !g:NERDTree.IsOpen() | ||
| 415 | return | ||
| 416 | endif | ||
| 417 | |||
| 418 | " Do not update when a special buffer is selected | ||
| 419 | if !empty(&l:buftype) | ||
| 420 | return | ||
| 421 | endif | ||
| 422 | |||
| 423 | " winnr need to make focus go to opened file | ||
| 424 | " CursorToTreeWin needed to avoid error on opening file | ||
| 425 | let l:winnr = winnr() | ||
| 426 | let l:altwinnr = winnr('#') | ||
| 427 | |||
| 428 | call g:NERDTree.CursorToTreeWin() | ||
| 429 | call b:NERDTree.root.refreshFlags() | ||
| 430 | call NERDTreeRender() | ||
| 431 | |||
| 432 | exec l:altwinnr . 'wincmd w' | ||
| 433 | exec l:winnr . 'wincmd w' | ||
| 434 | endfunction | ||
| 435 | |||
| 436 | " scope: local | ||
| 437 | function! s:hardRefreshNerdTree() | ||
| 438 | if g:webdevicons_enable_nerdtree == 1 && g:webdevicons_conceal_nerdtree_brackets == 1 && g:NERDTree.IsOpen() | ||
| 439 | NERDTreeClose | ||
| 440 | NERDTree | ||
| 441 | endif | ||
| 442 | endfunction | ||
| 443 | |||
| 444 | " scope: local | ||
| 445 | function! s:softRefreshNerdTree() | ||
| 446 | if g:webdevicons_enable_nerdtree == 1 && exists('g:NERDTree') && g:NERDTree.IsOpen() | ||
| 447 | NERDTreeToggle | ||
| 448 | NERDTreeToggle | ||
| 449 | endif | ||
| 450 | endfunction | ||
| 451 | |||
| 452 | " local initialization {{{2 | ||
| 453 | "======================================================================== | ||
| 454 | |||
| 455 | " scope: local | ||
| 456 | function! s:initialize() | ||
| 457 | call s:setDictionaries() | ||
| 458 | call s:setSyntax() | ||
| 459 | call s:setCursorHold() | ||
| 460 | |||
| 461 | if exists('g:loaded_flagship') | call devicons#plugins#flagship#init() | endif | ||
| 462 | if exists('g:loaded_unite') && g:webdevicons_enable_unite | call devicons#plugins#unite#init() | endif | ||
| 463 | if exists('g:loaded_denite') && g:webdevicons_enable_denite | call devicons#plugins#denite#init() | endif | ||
| 464 | if exists('g:loaded_vimfiler') && g:webdevicons_enable_vimfiler | call devicons#plugins#vimfiler#init() | endif | ||
| 465 | if exists('g:loaded_ctrlp') && g:webdevicons_enable_ctrlp | call devicons#plugins#ctrlp#init() | endif | ||
| 466 | if exists('g:loaded_startify') && g:webdevicons_enable_startify | call devicons#plugins#startify#init() | endif | ||
| 467 | endfunction | ||
| 468 | |||
| 469 | |||
| 470 | " public functions {{{2 | ||
| 471 | "======================================================================== | ||
| 472 | |||
| 473 | " scope: public | ||
| 474 | function! webdevicons#version() | ||
| 475 | return s:version | ||
| 476 | endfunction | ||
| 477 | |||
| 478 | " scope: public | ||
| 479 | function! webdevicons#pluginHome() | ||
| 480 | return s:plugin_home | ||
| 481 | endfunction | ||
| 482 | |||
| 483 | " scope: public | ||
| 484 | " allow the first version of refresh to now call softRefresh | ||
| 485 | function! webdevicons#refresh() | ||
| 486 | call webdevicons#softRefresh() | ||
| 487 | endfunction | ||
| 488 | |||
| 489 | " scope: public | ||
| 490 | function! webdevicons#hardRefresh() | ||
| 491 | call s:setSyntax() | ||
| 492 | call s:hardRefreshNerdTree() | ||
| 493 | endfunction | ||
| 494 | |||
| 495 | " scope: public | ||
| 496 | function! webdevicons#softRefresh() | ||
| 497 | call s:setSyntax() | ||
| 498 | call s:softRefreshNerdTree() | ||
| 499 | endfunction | ||
| 500 | |||
| 501 | " a:1 (bufferName), a:2 (isDirectory) | ||
| 502 | " scope: public | ||
| 503 | function! WebDevIconsGetFileTypeSymbol(...) abort | ||
| 504 | if a:0 == 0 | ||
| 505 | let fileNodeExtension = !empty(expand('%:e')) ? expand('%:e') : &filetype | ||
| 506 | let fileNode = expand('%:t') | ||
| 507 | let isDirectory = 0 | ||
| 508 | else | ||
| 509 | let fileNodeExtension = fnamemodify(a:1, ':e') | ||
| 510 | let fileNode = fnamemodify(a:1, ':t') | ||
| 511 | if a:0 > 1 | ||
| 512 | let isDirectory = a:2 | ||
| 513 | else | ||
| 514 | let isDirectory = 0 | ||
| 515 | endif | ||
| 516 | endif | ||
| 517 | |||
| 518 | if isDirectory == 0 || g:DevIconsEnableFolderPatternMatching | ||
| 519 | |||
| 520 | let symbol = g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol | ||
| 521 | let fileNodeExtension = tolower(fileNodeExtension) | ||
| 522 | let fileNode = tolower(fileNode) | ||
| 523 | |||
| 524 | for [pattern, glyph] in items(g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols) | ||
| 525 | if match(fileNode, pattern) != -1 | ||
| 526 | let symbol = glyph | ||
| 527 | break | ||
| 528 | endif | ||
| 529 | endfor | ||
| 530 | |||
| 531 | if symbol == g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol | ||
| 532 | if has_key(g:WebDevIconsUnicodeDecorateFileNodesExactSymbols, fileNode) | ||
| 533 | let symbol = g:WebDevIconsUnicodeDecorateFileNodesExactSymbols[fileNode] | ||
| 534 | elseif ((isDirectory == 1 && g:DevIconsEnableFolderExtensionPatternMatching) || isDirectory == 0) && has_key(g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols, fileNodeExtension) | ||
| 535 | let symbol = g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols[fileNodeExtension] | ||
| 536 | elseif isDirectory == 1 | ||
| 537 | let symbol = g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol | ||
| 538 | endif | ||
| 539 | endif | ||
| 540 | |||
| 541 | else | ||
| 542 | let symbol = g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol | ||
| 543 | endif | ||
| 544 | |||
| 545 | let artifactFix = s:DevIconsGetArtifactFix() | ||
| 546 | |||
| 547 | return symbol . artifactFix | ||
| 548 | |||
| 549 | endfunction | ||
| 550 | |||
| 551 | " scope: local | ||
| 552 | " Temporary (hopefully) fix for glyph issues in gvim (proper fix is with the | ||
| 553 | " actual font patcher) | ||
| 554 | function! s:DevIconsGetArtifactFix() | ||
| 555 | if g:DevIconsAppendArtifactFix == 1 | ||
| 556 | let artifactFix = g:DevIconsArtifactFixChar | ||
| 557 | else | ||
| 558 | let artifactFix = '' | ||
| 559 | endif | ||
| 560 | |||
| 561 | return artifactFix | ||
| 562 | endfunction | ||
| 563 | |||
| 564 | " scope: public | ||
| 565 | function! WebDevIconsGetFileFormatSymbol(...) | ||
| 566 | let fileformat = '' | ||
| 567 | let bomb = '' | ||
| 568 | |||
| 569 | if (&bomb && g:WebDevIconsUnicodeByteOrderMarkerDefaultSymbol !=? '') | ||
| 570 | let bomb = g:WebDevIconsUnicodeByteOrderMarkerDefaultSymbol . ' ' | ||
| 571 | endif | ||
| 572 | |||
| 573 | if &fileformat ==? 'dos' | ||
| 574 | let fileformat = '' | ||
| 575 | elseif &fileformat ==? 'unix' | ||
| 576 | let fileformat = s:isDarwin() ? '' : s:getDistro() | ||
| 577 | elseif &fileformat ==? 'mac' | ||
| 578 | let fileformat = '' | ||
| 579 | endif | ||
| 580 | |||
| 581 | let artifactFix = s:DevIconsGetArtifactFix() | ||
| 582 | |||
| 583 | return bomb . fileformat . artifactFix | ||
| 584 | endfunction | ||
| 585 | |||
| 586 | " for airline plugin {{{3 | ||
| 587 | "======================================================================== | ||
| 588 | |||
| 589 | " scope: public | ||
| 590 | function! AirlineWebDevIcons(...) | ||
| 591 | let w:airline_section_x = get(w:, 'airline_section_x', | ||
| 592 | \ get(g:, 'airline_section_x', '')) | ||
| 593 | let w:airline_section_x .= ' %{WebDevIconsGetFileTypeSymbol()} ' | ||
| 594 | let hasFileFormatEncodingPart = airline#parts#ffenc() !=? '' | ||
| 595 | if g:webdevicons_enable_airline_statusline_fileformat_symbols && hasFileFormatEncodingPart | ||
| 596 | let w:airline_section_y = ' %{&fenc . " " . WebDevIconsGetFileFormatSymbol()} ' | ||
| 597 | endif | ||
| 598 | endfunction | ||
| 599 | |||
| 600 | if g:webdevicons_enable == 1 && exists('g:loaded_airline') && g:loaded_airline == 1 && g:webdevicons_enable_airline_statusline | ||
| 601 | call airline#add_statusline_func('AirlineWebDevIcons') | ||
| 602 | endif | ||
| 603 | |||
| 604 | if g:webdevicons_enable == 1 && g:webdevicons_enable_airline_tabline | ||
| 605 | " Store original formatter. | ||
| 606 | let g:_webdevicons_airline_orig_formatter = get(g:, 'airline#extensions#tabline#formatter', 'default') | ||
| 607 | let g:airline#extensions#tabline#formatter = 'webdevicons' | ||
| 608 | endif | ||
| 609 | |||
| 610 | " for nerdtree plugin {{{3 | ||
| 611 | "======================================================================== | ||
| 612 | |||
| 613 | " scope: public | ||
| 614 | function! NERDTreeWebDevIconsRefreshListener(event) | ||
| 615 | let path = a:event.subject | ||
| 616 | let postPadding = g:WebDevIconsNerdTreeAfterGlyphPadding | ||
| 617 | let prePadding = g:WebDevIconsNerdTreeBeforeGlyphPadding | ||
| 618 | let hasGitFlags = (len(path.flagSet._flagsForScope('git')) > 0) | ||
| 619 | let hasGitNerdTreePlugin = (exists('g:loaded_nerdtree_git_status') == 1) | ||
| 620 | let artifactFix = s:DevIconsGetArtifactFix() | ||
| 621 | |||
| 622 | " align vertically at the same level: non git-flag nodes with git-flag nodes | ||
| 623 | if g:WebDevIconsNerdTreeGitPluginForceVAlign && !hasGitFlags && hasGitNerdTreePlugin | ||
| 624 | let prePadding .= ' ' | ||
| 625 | endif | ||
| 626 | |||
| 627 | if !path.isDirectory | ||
| 628 | " Hey we got a regular file, lets get it's proper icon | ||
| 629 | let flag = prePadding . WebDevIconsGetFileTypeSymbol(path.str()) . postPadding | ||
| 630 | |||
| 631 | elseif path.isDirectory && g:WebDevIconsUnicodeDecorateFolderNodes == 1 | ||
| 632 | " Ok we got a directory, some more tests and checks | ||
| 633 | let directoryOpened = 0 | ||
| 634 | |||
| 635 | if g:DevIconsEnableFoldersOpenClose && len(path.flagSet._flagsForScope('webdevicons')) > 0 | ||
| 636 | " did the user set different icons for open and close? | ||
| 637 | |||
| 638 | " isOpen is not available on the path listener directly | ||
| 639 | " but we added one via overriding particular keymappings for NERDTree | ||
| 640 | if has_key(path, 'isOpen') && path.isOpen == 1 | ||
| 641 | let directoryOpened = 1 | ||
| 642 | endif | ||
| 643 | endif | ||
| 644 | |||
| 645 | if g:WebDevIconsUnicodeDecorateFolderNodesExactMatches == 1 | ||
| 646 | " Did the user enable exact matching of folder type/names | ||
| 647 | " think node_modules | ||
| 648 | if g:DevIconsEnableFoldersOpenClose && directoryOpened | ||
| 649 | " the folder is open | ||
| 650 | let flag = prePadding . g:DevIconsDefaultFolderOpenSymbol . artifactFix . postPadding | ||
| 651 | else | ||
| 652 | " the folder is not open | ||
| 653 | if path.isSymLink | ||
| 654 | " We have a symlink | ||
| 655 | let flag = prePadding . g:WebDevIconsUnicodeDecorateFolderNodesSymlinkSymbol . artifactFix . postPadding | ||
| 656 | else | ||
| 657 | " We have a regular folder | ||
| 658 | let flag = prePadding . WebDevIconsGetFileTypeSymbol(path.str(), path.isDirectory) . postPadding | ||
| 659 | endif | ||
| 660 | endif | ||
| 661 | |||
| 662 | else | ||
| 663 | " the user did not enable exact matching | ||
| 664 | if g:DevIconsEnableFoldersOpenClose && directoryOpened | ||
| 665 | " the folder is open | ||
| 666 | let flag = prePadding . g:DevIconsDefaultFolderOpenSymbol . artifactFix . postPadding | ||
| 667 | else | ||
| 668 | " the folder is not open | ||
| 669 | if path.isSymLink | ||
| 670 | " We have a symlink | ||
| 671 | let flag = prePadding . g:WebDevIconsUnicodeDecorateFolderNodesSymlinkSymbol . artifactFix . postPadding | ||
| 672 | else | ||
| 673 | " We have a regular folder | ||
| 674 | let flag = prePadding . g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol . artifactFix . postPadding | ||
| 675 | endif | ||
| 676 | endif | ||
| 677 | |||
| 678 | endif | ||
| 679 | |||
| 680 | else | ||
| 681 | let flag = prePadding . ' ' . artifactFix . postPadding | ||
| 682 | endif | ||
| 683 | |||
| 684 | call path.flagSet.clearFlags('webdevicons') | ||
| 685 | |||
| 686 | if flag !=? '' | ||
| 687 | call path.flagSet.addFlag('webdevicons', flag) | ||
| 688 | endif | ||
| 689 | |||
| 690 | endfunction | ||
| 691 | |||
| 692 | " call setup after processing all the functions (to avoid errors) {{{1 | ||
| 693 | "======================================================================== | ||
| 694 | " had some issues with VimEnter, for now using: | ||
| 695 | call s:initialize() | ||
| 696 | |||
| 697 | " standard fix/safety: line continuation (avoiding side effects) {{{1 | ||
| 698 | "======================================================================== | ||
| 699 | let &cpo = s:save_cpo | ||
| 700 | unlet s:save_cpo | ||
| 701 | |||
| 702 | " modeline syntax: | ||
| 703 | " vim: fdm=marker tabstop=2 softtabstop=2 shiftwidth=2 expandtab: | ||
