├── .github ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── ci.yml │ └── vint.yml ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── DEVELOPER.md ├── LICENSE ├── README.md ├── autoload ├── airline │ └── extensions │ │ └── tabline │ │ └── formatters │ │ └── webdevicons.vim ├── devicons │ └── plugins │ │ ├── ctrlp.vim │ │ ├── denite.vim │ │ ├── flagship.vim │ │ ├── startify.vim │ │ ├── unite.vim │ │ └── vimfiler.vim └── vimfiler │ └── columns │ └── devicons.vim ├── doc └── webdevicons.txt ├── nerdtree_plugin └── webdevicons.vim ├── plugin └── webdevicons.vim ├── pythonx └── vim_devicons │ ├── __init__.py │ └── powerline │ ├── __init__.py │ └── segments.py ├── rplugin └── python3 │ └── denite │ └── filter │ └── devicons_denite_converter.py └── test ├── .themisrc ├── default_setting.vim ├── fileformat.vim └── filetype.vim /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | #### Requirements 2 | 3 | 7 | 8 | #### Required Info 9 | 10 | 11 | 12 | - [ ] I have searched the [issues](https://github.com/ryanoasis/vim-devicons/issues) for my issue and found nothing related and/or helpful 13 | - [ ] I have read or at least glanced at the [FAQ](https://github.com/ryanoasis/vim-devicons/wiki/FAQ-&-Troubleshooting) 14 | - [ ] I have read or at least glanced at the [Wiki](https://github.com/ryanoasis/vim-devicons/wiki) 15 | - [ ] `VimDevIcons` is the last loaded vim plugin? 16 | - [ ] What **version** of vim are you using? 17 | - hint: `vim --version` 18 | - [ ] What **font** are you using? 19 | - [ ] Are you using vim from the terminal or a GUI vim? 20 | - [ ] Are you using Mac, Linux or Windows? 21 | 22 | #### Optional Info 23 | 24 | - [ ] Provide **screenshots** where appropriate 25 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | #### Requirements (please check off with 'x') 2 | 3 | - [ ] I have read the [Contributing Guidelines](https://github.com/ryanoasis/vim-devicons/blob/master/CONTRIBUTING.md) 4 | - [ ] I have read or at least glanced at the [FAQ](https://github.com/ryanoasis/vim-devicons#faq--troubleshooting) 5 | - [ ] I have read or at least glanced at the [Wiki](https://github.com/ryanoasis/vim-devicons/wiki) 6 | 7 | #### What does this Pull Request (PR) do? 8 | 9 | #### How should this be manually tested? 10 | 11 | #### Any background context you can provide? 12 | 13 | #### What are the relevant tickets (if any)? 14 | 15 | #### Screenshots (if appropriate or helpful) 16 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | test: 13 | name: Test 14 | runs-on: ubuntu-latest 15 | strategy: 16 | matrix: 17 | vim: 18 | - v9.0.0000 19 | - v8.2.1000 20 | - v8.2.0000 21 | - v8.1.0000 22 | - v8.0.0000 23 | 24 | steps: 25 | - name: Checkout code 26 | uses: actions/checkout@main 27 | - name: Checkout vim-themis 28 | uses: actions/checkout@main 29 | with: 30 | repository: thinca/vim-themis 31 | path: vim-themis 32 | 33 | - name: Setup Vim 34 | uses: rhysd/action-setup-vim@v1 35 | id: vim 36 | with: 37 | version: ${{ matrix.vim }} 38 | 39 | - name: Test 40 | env: 41 | THEMIS_VIM: ${{ steps.vim.outputs.executable }} 42 | run: ./vim-themis/bin/themis --reporter spec 43 | -------------------------------------------------------------------------------- /.github/workflows/vint.yml: -------------------------------------------------------------------------------- 1 | name: vint 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | jobs: 11 | build: 12 | 13 | runs-on: ubuntu-latest 14 | strategy: 15 | matrix: 16 | python-version: [3.8] 17 | 18 | steps: 19 | - uses: actions/checkout@main 20 | - name: Set up Python ${{ matrix.python-version }} 21 | uses: actions/setup-python@main 22 | with: 23 | python-version: ${{ matrix.python-version }} 24 | - name: Install dependencies 25 | run: | 26 | python -m pip install --upgrade pip 27 | - name: Install vint 28 | run: | 29 | pip install vim-vint 30 | - name: Run vint 31 | run: | 32 | vint --verbose --stat $(find . -type f -name '*.vim') 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | doc/tags 2 | __pycache__/ 3 | .DS_Store 4 | .netrwhist 5 | *.swp 6 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | CHANGELOG 3 | ================================================================================ 4 | This project is using [Semantic Versioning 2.0.0](http://semver.org/) 5 | 6 | - v0.11.0 7 | - Added Docker filetypes support (PR #228) (@IngoHeimbach) 8 | - Added Swift filetypes support (PR #252) (@motform) 9 | - Added Elixir filetypes support (PR #244) (@akoutmos) 10 | - Added configuration for 'prePadding' (fixes #231) 11 | - Added support for `vue` filetype extensions out-of-the-box (fixes #235) 12 | - Added configuration for 'DevIconsArtifactFix' (#225) 13 | - Added leftrelease override to work on single mouse click (PR #246) (@Matrix86) 14 | - Added Travis CI with vim linting (PR #236) (@kutsan) 15 | - Fixed Vim-Startify no longer working "out of the box" (#233) 16 | - Fixed Denite information being discarded (fixes #216) (PR #229 @carlitux) 17 | - Fixed inconsistent spacing between folder and file glyphs (fixes #213) 18 | - Updated variable declarations and refactored into set function (PR #237) (@kutsan) 19 | - Updated plugin initialization functions to autoload on demand (PR #238) (@kutsan) 20 | - Updated documentation and refactored massively to Wiki (PR #232) (@kutsan) 21 | - Updated `vim` glyph to better glyph (fixes #234) 22 | - Updated Readme screenshots and badges 23 | - v0.10.0 24 | - Added support for symlink directories (PR #221) (@mhartington) 25 | - Added missing Denite config in readme (PR #217, fixes #205) (@mohamadLy) 26 | - Fixed NERDTree folder open bug with cascade setting (fixes #194) 27 | - Fixed potential issue with Vim-Airline (PR #219) (@chrisbra) 28 | - Fixed readme.md (removed duplicate section) (PR #222) (@thehappydinoa) 29 | - Updated Vim-Airline Repo link in readme (PR #220) (@chrisbra) 30 | - v0.9.3 31 | - Added `tsx` filetype (PR #210) (@dustinblackman) 32 | - Updated links of [deprecated kien/ctrlp](https://github.com/kien/ctrlp.vim) to [active ctrlp fork](https://github.com/ctrlpvim/ctrlp.vim) (PR #211) (@haxorjim) 33 | - Updated MacOS and Windows `guifont` examples with alternate format (fixes #208) 34 | - v0.9.2 35 | - Added `yaml` filetype (PR #207) (@jpoppe) 36 | - Added mention of `vim-workspace` as an integrated plugin (PR #206) (@bagrat) 37 | - Fixed NERDTree keymap `U` open folder icon bug (fixes #189) 38 | - v0.9.1 39 | - Added `sass` filetype (PR #202) (@toastal) 40 | - Fixed NERDTree open/close folder icon bugs (fixes #194) 41 | - Fixed airline conflict with file enconding `skip_expected_string` feature (fixes #203) 42 | - Fixed possible glyph artifacts on open/close folder glyphs 43 | - v0.9.0 44 | - Added support for [Denite](https://github.com/Shougo/denite.nvim) (PR #191) (@0phoff) 45 | - Added symbol for byte order marker (BOM) (utf-8) (PR #199) (@Snaptags) 46 | - Added support for `.zshrc`, `.vimrc`, `pp` (Puppet classes extensions), and `Vagrantfile` filetypes (enhancement #200) (@kiyanwang) 47 | - Added support for `h`, `hpp`, `hxx` (C/C++ header filetype extensions) (enhancement #190) 48 | - Added support for `bash`, `zsh`, `ksh`, `csh`, `awk`, `ps1` (script extensions) (enhancement #196) 49 | - Added support for `rmd` (R Markdown) (partially fixes #195) 50 | - Fixes opened folders titles padding/spacing offset (fixes #197) 51 | - v0.8.6 52 | - Added support for vimfiler explorer mode (fixes #171) 53 | - Added `doc/tags` to `.gitignore` (PR #182) (@doronbehar) 54 | - Added warning to readme pertaining to old versions of NERDTree and CtrlP (PR #177, fixes #174) (@Melon-Bread) 55 | - Fixes CtrlP buffer names (PR #185) (@HerringtonDarkholme) 56 | - Fixes character encoding issue in vim doc (PR #178) (@mhartington) 57 | - Fixes extraneous space after glyph in airline (PR #184) (@tbodt) 58 | - Fixes errors when NERDTree not present (PR #187) (@blueyed) 59 | - Updated Contributor Covenant to `v1.4` 60 | - Updated API examples 61 | - v0.8.5 62 | - Fixed errors in neovim (E670) (PR #163, fixes #162) (@mhartington) 63 | - Fixed issue of updating NERDTree window via `CursorHoldUpdate` (PR #166) (@svanharmelen) 64 | - Fixes updating of special buffer when selected 65 | - Fixes potential issues CtrlP opening in wrong buffer when NERDTree is opened 66 | - Fixed issue with CtrlP `:CtrlPMRU` always defaulting to current buffer (fixes #88) 67 | - Also adds glyphs to other CtrlP modes besides MRU as a side effect 68 | - Fixed documentation discrepency on pluging load order (PR #169) (@F1LT3R) 69 | - Fixed documentation related to CtrlP MRU mode (PR #170, fixes #168) (@F1LT3R) 70 | - v0.8.4 71 | - Fixed always warning about deprecated CtrlP version (fixes #137) 72 | - Fixed missing configuration info about pattern based symbols (fixes #152) 73 | - Fixed `WebDevIconsGetFileTypeSymbol` method iterator missing `break` (PR #156) (@blueyed) 74 | - Fixed a typo in the readme (PR #159) (@SSARCandy) 75 | - Added reference to [tiagofumo/vim-nerdtree-syntax-highlight](https://github.com/tiagofumo/vim-nerdtree-syntax-highlight) in readme (PR #161) (@tiagofumo) 76 | - However, the [FAQ](https://github.com/ryanoasis/vim-devicons/wiki/FAQ) has been moved to the [Wiki](https://github.com/ryanoasis/vim-devicons/wiki) in this release 77 | - v0.8.3 78 | - Fixed NERDTree not displaying glyph (icon) for newly created files (fixes #153) 79 | - Also adds info to readme about `updatetime` 80 | - Fixed resourcing `vimrc` not maintaining current NERDTree state (fixes #154) 81 | - Adds new public methods `webdevicons#hardRefresh()` and `webdevicons#softRefresh()` 82 | - Makes public method `webdevicons#refresh()` do a 'soft' refresh 83 | - Fixed various source formatting and implemented most of vim lint ([vint](https://github.com/Kuniwak/vint)) recommendations 84 | - Added public methods available to readme 85 | - v0.8.2 86 | - Updated `jsx` filetype (using React glyph) (enhancement PR #148) (@alpertuna) 87 | - Added issue and pull request templates 88 | - v0.8.1 89 | - Fixed Unite display issues (absolute paths and/or duplicate paths) (fixes #140) 90 | - Fixed custom CtrlP open function causing 'E16' (fixes #115) 91 | - Fixed typo in readme for setting default folder glyph (PR #143) 92 | - Added documentation for highlighting icon/glyphs only (not just entire lines) in NERDTree (fixes #142) 93 | - v0.8.0 94 | - Added support for more [unite](https://github.com/Shougo/unite.vim) actions: `file_rec/async`, `file_rec/neovim`, `file_rec/neovim2`, `file_rec/git` (enhancement PR #132, fixes #131) (@mhartington) 95 | - Improved Darwin detection by using a lighter method/logic (#135) (@delphinus35) 96 | - Fixes `NERDTree-C` (fix PR #139) (@endenwer) 97 | - Fixes error using open/close symbols for folder (fixes #130) 98 | - v0.7.1 99 | - Misc readme updates 100 | - Fixed performance issues and odd graphical artifacts in v0.7.0 (fixes #127) 101 | - Improved installation instructions and re-organized some items to [Nerd Fonts repo](https://github.com/ryanoasis/nerd-fonts) (PR #129, fixes #125, #128) (@her) 102 | - v0.7.0 103 | - Deprecated support for [kien/ctrlp](https://github.com/kien/ctrlp.vim) and only support [active ctrlp fork](https://github.com/ctrlpvim/ctrlp.vim) going forward (fixes #117) 104 | - Added information to readme about [vim-startify](https://github.com/mhinz/vim-startify) support (enhancement #94) 105 | - Added information to readme with possible fix to 'Dots after icons' (fixes #110) (@KabbAmine) 106 | - Added support for 'cljc' (Clojure) filetypes (fix PR #120) (@spacepluk) 107 | - Fixed certain folders in NERDTree showing file glyphs (based on pattern matching) (fixes #112) 108 | - Fixed OS icon being display with as Linux Tux on Mac (fixes #118,fix PR #121) (@trodrigu) 109 | - Fixed deprecated Linux font path in readme (fix PR #123) (@jrobeson) 110 | - v0.6.1 111 | - Fixed likely breaking bug: undefined variable g:DevIconsEnableFoldersOpenClose (fixes #109) 112 | - Fixed up the changelog details 113 | - v0.6.0 114 | - Added support for [Powerline](https://github.com/powerline/powerline) (enhancement PR #74) (@delphinus35) 115 | - Added support for 'ts' (TypeScript) filetypes (enhancement #79) 116 | - Added support for 'jl' (Julia) filetypes 117 | - Added support for 'bat' (batch) filetypes 118 | - Added support for 'ejs' (Embedded JavaScript Templates) filetypes (enhancement #105) (@lerrua) 119 | - Added support for 'react.jsx' filetype 120 | - Added support for 'procfile' filetype 121 | - Changed default 'go' filetype glyph to a better one 122 | - Added open & close folder glyphs (icons) (enhancement #104) 123 | - Fixed new files not having icons until refreshing NERDTree (fixes #33) 124 | - Solution very similar to [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin) 125 | - v0.5.4 126 | - Misc readme updates 127 | - Add support for ocaml 'ml', 'mli' filetypes (enhancement PR #99) (@CharlieMartell) 128 | - Add support for 'sql' and 'dump' filetypes (enhancement PR #100) (@lerrua) 129 | - Add support for 'ico' filetypes (enhancement PR #101) (@lerrua) 130 | - Add support for 'markdown' filetypes (enhancement PR #102) (@lerrua) 131 | - Improved install fonts instructions on Mac (enhancement PR #103) (@lerrua) 132 | - v0.5.3 133 | - Add 'slim' filetype support (same icon as 'html') (enhancement PR #98) (@lerrua) 134 | - Add 'fish' filetype support (same icon as 'sh') (enhancement #93) (@michaelmrose) 135 | - Updated old link references (enhancement PR #87) (@lerrua) 136 | - Improved default Ruby icon (uses 'glyph set 2') (enhancement PR #97) (@lerrua) 137 | - Prevent destorying user's conceal settings (Use setlocal) (enhancement PR #96) (@shawncplus) 138 | - Fixes filenames of buffers getting lost in unite filter (fixes #86) (@ahrse) 139 | - Various readme updates and fixes 140 | - v0.5.2 141 | - Various readme updates and fixes 142 | - Various file clean-up (.gitignore removed) 143 | - Fixed link to install fonts (PR #83 fixes #81) (@theRemix) 144 | - Fixed glyph used for Go (PR #82) (@hoop33) 145 | - Added Code of Conduct 146 | - v0.5.1 147 | - Fixed [CtrlP](https://github.com/ctrlpvim/ctrlp.vim) integration bugs (truncating 6 characters is unreliable) and only add glyphs for MRU File Mode (Fixes #80) 148 | - Readme updates and improvements 149 | - v0.5.0 150 | - Readme updates (removed polls sections, v0.5.0 specific changes) 151 | - Misc code formatting fixes (tabs to spaces, modeline additions, reorganization) 152 | - Update API: make WebDevIconsGetFileFormatSymbol return only fenc (fixes #73) 153 | - Added Perl support (enhancement #60) 154 | - Added support for some (mostly frontend) frameworks (enhancement #61) 155 | - Added basic support for vim-flagship (enhancement #70) 156 | - Added support for Unite and Vimfiler (enhancement #54) 157 | - Added support for CtrlP (enhancement #56) 158 | - Rebranding part 1: title and image (vim-devicons) (enhancement #76) 159 | - v0.4.4 160 | - Lots of readme updates and tweaks 161 | - Changelog semver details 162 | - Spelling / confusing grammar corrections (PR #68) (@adelarsq) 163 | - Fixed default folder/directory glyph (PR Fixes #72) (@cj) 164 | - Mac OS X screenshot (Fixes #32) (@RageZBla) 165 | - Fixed misalignment when used with [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin) (Fixes #71) 166 | - Fixed re-sourcing bug (Fixes #71) 167 | - Fixed directory node user settings being overwritten (Fixes #59) 168 | - Fixed minor screenshot issues and clean-up 169 | - v0.4.3 170 | - Prevent error 'Unknown function' when opening Vim without airline plugin (Fixes #67) 171 | - Temporary fix for gvim glyph artifact issues (particuarly NERDTree) (Fixes #58) 172 | - Support file format symbols (glyphs) in vim-airline (Enhancement #66) 173 | - Add vimrc setup example to readme (Documentation #65) 174 | - Fixes Conceal highlighting issues (Fixes #53, #52) 175 | - Make sure plugin plays nice with [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin) (Enhancement #62) 176 | - general readme updates and improvements 177 | - changelog format fixes 178 | - v0.4.2 179 | - Updated vim doc with latest readme updates (html2vimdoc) 180 | - Fixes #7 update readme for font and vim setup on osx and win platforms 181 | - Fixes #49 with a FAQ update 182 | - Fixes #41 No such event: nerdtree syntax match (@nbicalcarata) 183 | - Removed test files from the repo and added folders to git-ignore 184 | - Warn about loading vim-webdevicons before nerdtree plugin 185 | - fix lazy NERDTree (@blueyed) 186 | - Improve conceiling with NERDTree (@blueyed) 187 | - add instructions to readme for vim setup on os x (@alfredbez) 188 | - v0.4.1 189 | - Fixes #39 - updated screenshots (particularly nerdtree) 190 | - Fixes #37 - g:webdevicons_conceal_nerdtree_brackets applying global config 191 | - Add instructions to readme for adding icon to lightline (@hoop33) 192 | - Updated vim doc with latest readme updates (sync'd with html2vimdoc) 193 | - Added TL;DR section to readme 194 | - Add a note to readme to load NERDTree before vim-webdevicons (@hoop33) 195 | - Fix: Automatically turning off NERDTree support (@hoop33) 196 | - general readme updates 197 | - v0.4.0 198 | - #27 Remove [ ] wrapping icons 199 | - #26 Add detection and warning on unsupported (old) NERDTree versions 200 | - updated readme with more links and new details on new features and conifgs 201 | - #30 Improve vim standard plugin conventions and tips 202 | - #30 work on sections and standard plugin conventions part 1 203 | - #30 clean-up of unused (for now) autoload file 204 | - #28 setting global options broken part 1 205 | - #29 Add vimdoc, more updates 206 | - autogenerating vimdoc using html2vimdoc 207 | - readme updates 208 | - v0.3.4 209 | - Adds basic support for directory/folder glyphs - fixes #22 210 | - optimize icon lookup - WebDevIconsGetFileTypeSymbol: use if/else (@blueyed) 211 | - Do not clobber the default or customized airline formatter (@blueyed) 212 | - fixed a bug related to the latest airline updates (Ali Aliev) 213 | - various readme updates 214 | - more sample usage images 215 | - v0.3.3 216 | - Load the plugin once only (@blueyed) 217 | - Add font installation instructions, fixes #5 (@wikimatze) 218 | - added plugin install instructions 219 | - slight readme re-ordering 220 | - moved contributing section near bottom 221 | - added additional screenshots 222 | - added more thanks to those whose some more of the glyphs came from 223 | - v0.3.2 224 | - moved screenshots into the wiki (wiki.vim-webdevicons) to reduce unnecessary project size of cloning repo 225 | - v0.3.1 226 | - readme updates (with references to new font-patcher repo) 227 | - readme updates screenshots reference wiki 228 | - v0.3.0 229 | - moved font-patcher and patched fonts into a separate repo (nerd-filetype-glyphs-fonts-patcher) 230 | - adds twigg file type support for #10 (@wikimatze) 231 | - adds cpp file type support 232 | - updated utf8 test file with glyphs 233 | - readme fixes (@wikimatze, @blueyed) 234 | - readme updates 235 | - v0.2.1 236 | - readme updates 237 | - v0.2.0 238 | - Script for patching any font: Initial cleaned up work for issue (feature enhancement) for #1 239 | - added python font patcher and readme updates 240 | - v0.1.4 241 | - readme updates 242 | - v0.1.3 243 | - fixes #3 make matches case insensitive (ignore case) 244 | - v0.1.2 245 | - fixes lookup for exact file notes (@johngeorgewright) 246 | - v0.1.1 247 | - updated readme substantially 248 | - v0.1.0 249 | - release 250 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team on 59 | [VimDevIcons Gitter Chat](https://gitter.im/ryanoasis/vim-devicons) 60 | or contacting [@ryanoasis](https://github.com/ryanoasis). All 61 | complaints will be reviewed and investigated and will result in a response that 62 | is deemed necessary and appropriate to the circumstances. The project team is 63 | obligated to maintain confidentiality with regard to the reporter of an incident. 64 | Further details of specific enforcement policies may be posted separately. 65 | 66 | Project maintainers who do not follow or enforce the Code of Conduct in good 67 | faith may face temporary or permanent repercussions as determined by other 68 | members of the project's leadership. 69 | 70 | ## Attribution 71 | 72 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 73 | available at [http://contributor-covenant.org/version/1/4][version] 74 | 75 | [homepage]: http://contributor-covenant.org 76 | [version]: http://contributor-covenant.org/version/1/4/ 77 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guide 2 | 3 | ## How to contribute 4 | 5 | * Fork the project and submit a Pull Request (PR) 6 | * Explain what the PR fixes or improves 7 | * Screenshots for bonus points 8 | * Use sensible commit messages 9 | * If your PR fixes a separate issue number, include it in the commit message 10 | 11 | ## Things to keep in mind 12 | 13 | * Smaller PRs are likely to be merged more quickly than bigger changes 14 | * If it is a useful PR it **will** get merged in eventually 15 | * [E.g. see how many have already been merged vs. still open](https://github.com/ryanoasis/vim-devicons/pulls) 16 | * This project _was_ using [Semantic Versioning 2.0.0](http://semver.org/) but we have since mostly abandoned that 17 | * Try to add to the unit tests where possible so we can maintain our test coverage 18 | * Issues not filled out with the template will be closed straight away and will only be responded to once filled properly 19 | -------------------------------------------------------------------------------- /DEVELOPER.md: -------------------------------------------------------------------------------- 1 | ### API 2 | 3 | ```vim 4 | " returns the font character that represents the icon 5 | " parameters: a:1 (filename), a:2 (isDirectory) 6 | " both parameters optional 7 | " by default without parameters uses buffer name 8 | WebDevIconsGetFileTypeSymbol(...) 9 | 10 | " returns the font character that represents 11 | " the file format as an icon (windows, linux, mac) 12 | WebDevIconsGetFileFormatSymbol() 13 | ``` 14 | 15 | #### Public Methods 16 | 17 | ```vim 18 | " Returns the current version of the plugin 19 | webdevicons#version() 20 | ``` 21 | 22 | ```vim 23 | " Calls webdevicons#softRefresh() 24 | " basically a backwards compatibility convenience 25 | webdevicons#refresh() 26 | ``` 27 | 28 | ```vim 29 | " Does a 'hard' refresh of NERDTree 30 | " resets vim-devicons syntax and closes and reopens NERDTree 31 | webdevicons#hardRefresh() 32 | ``` 33 | 34 | ```vim 35 | " Does a 'soft' refresh of NERDTree 36 | " resets vim-devicons syntax and toggles NERDTree to the same state 37 | webdevicons#softRefresh() 38 | ``` 39 | 40 | #### API Examples 41 | 42 | ##### Status line 43 | 44 | > Custom vim status line (not relying on vim-airline or lightline): 45 | 46 | ```vim 47 | set statusline=%f\ %{WebDevIconsGetFileTypeSymbol()}\ %h%w%m%r\ %=%(%l,%c%V\ %Y\ %=\ %P%) 48 | ``` 49 | 50 | ##### Simple function call 51 | 52 | ```vim 53 | echo WebDevIconsGetFileFormatSymbol() 54 | ``` 55 | 56 | #### Integration with other plugins 57 | 58 | ##### vim-startify 59 | 60 | ```vim 61 | let entry_format = "' ['. index .']'. repeat(' ', (3 - strlen(index)))" 62 | 63 | if exists('*WebDevIconsGetFileTypeSymbol') " support for vim-devicons 64 | let entry_format .= ". WebDevIconsGetFileTypeSymbol(entry_path) .' '. entry_path" 65 | else 66 | let entry_format .= '. entry_path' 67 | endif 68 | ``` 69 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | VimDevIcons - Add Icons to Your Plugins 3 |

4 | 5 |
6 | 7 | ![version](https://img.shields.io/github/release/ryanoasis/vim-devicons.svg?style=for-the-badge) 8 | ![chat on gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg?style=for-the-badge) 9 | ![code of conduct](https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=for-the-badge) 10 | ![prs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge&logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACWFBMVEXXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWkrXWko2FeWCAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAI28AACNvATX8B%2FsAAAAHdElNRQfhBQMBMCLAfV85AAAAi0lEQVQ4y2NgIBYszkPmJc5ORZE9DgEJqNxmmPS%2B43AA4h5B5TIwbD5%2BHFnoKCoXYSBMBIW7CF0eAxChoPM4ARXHB4GCZEIKKA8H%2FCoWE1LAwIBfBVp6wQA1DPhVzMJMcyggCVuqxGI%2FLhWY6Z6QPKoK7HmHkDwDwxYC8gwMdSDprXiz6PHjpQxUBgCLDfI7GXNh5gAAAABJRU5ErkJggg%3D%3D) 11 | ![CI](https://img.shields.io/github/workflow/status/ryanoasis/vim-devicons/CI?label=CI&style=for-the-badge) 12 | 13 |
14 | 15 | > Supports plugins such as [NERDTree](https://github.com/preservim/nerdtree), [vim-airline](https://github.com/vim-airline/vim-airline), [CtrlP](https://github.com/ctrlpvim/ctrlp.vim), [powerline](https://github.com/powerline/powerline), [denite](https://github.com/Shougo/denite.nvim), [unite](https://github.com/Shougo/unite.vim), [lightline.vim](https://github.com/itchyny/lightline.vim), [vim-startify](https://github.com/mhinz/vim-startify), [vimfiler](https://github.com/Shougo/vimfiler.vim), [vim-buffet](https://github.com/bagrat/vim-buffet) and [flagship](https://github.com/tpope/vim-flagship). 16 | 17 |

18 | vim-devicons overall screenshot 19 |

20 | 21 | > See [Screenshots](https://github.com/ryanoasis/vim-devicons/wiki/screenshots) for more. 22 | 23 | Features 24 | -------- 25 | 26 | - Adds filetype glyphs (icons) to various vim plugins. 27 | - Customizable and extendable glyphs settings. 28 | - Supports a wide range of file type extensions. 29 | - Supports popular full filenames, like `.gitignore`, `node_modules`, `.vimrc`, and many more. 30 | - Supports byte order marker (BOM). 31 | - Works with patched fonts, especially [Nerd Fonts](https://github.com/ryanoasis/nerd-fonts). 32 | 33 | > See [Detailed Features](https://github.com/ryanoasis/vim-devicons/wiki/Detailed-Features) for more. 34 | 35 | > See [Configuration](https://github.com/ryanoasis/vim-devicons/wiki/Extra-Configuration) for a list of configuration and customization options. 36 | 37 | Installation 38 | ------------ 39 | 40 | 1. Install a [Nerd Font compatible font](https://github.com/ryanoasis/nerd-fonts#font-installation) or [patch your own](https://github.com/ryanoasis/nerd-fonts#font-patcher). Then set your terminal font (or `guifont` if you are using GUI version of Vim). 41 | 1. Install the Vim plugin with your favorite plugin manager, e.g. [vim-plug](https://github.com/junegunn/vim-plug): 42 | 43 | ```vim 44 | Plug 'ryanoasis/vim-devicons' 45 | ``` 46 | 47 | > Always load the vim-devicons as the very last one. 48 | 49 | 1. Configure Vim 50 | 51 | ```vim 52 | set encoding=UTF-8 53 | ``` 54 | 55 | > No need to set explicitly under Neovim: always uses UTF-8 as the default encoding. 56 | 57 | 58 | > See [Installation](https://github.com/ryanoasis/vim-devicons/wiki/Installation) for detailed setup instructions 59 | 60 | Use `:help devicons` for further configuration. 61 | 62 | Developers 63 | ---------- 64 | 65 | See [DEVELOPER](DEVELOPER.md) for how to use the API. 66 | 67 | Troubleshooting 68 | --------------- 69 | 70 | See [FAQ](https://github.com/ryanoasis/vim-devicons/wiki/FAQ-&-Troubleshooting). 71 | 72 | Contributing 73 | ------------ 74 | 75 | ### [Code of Conduct](CODE_OF_CONDUCT.md) 76 | 77 | This project has adopted a Code of Conduct that we expect project participants to adhere to. Check out [code of conduct](CODE_OF_CONDUCT.md) for further details. 78 | 79 | ### [Contributing Guide](CONTRIBUTING.md) 80 | 81 | Read our [contributing](CONTRIBUTING.md) guide to learn about how to send pull requests, creating issues properly. 82 | 83 | ### Promotion 84 | 85 | You can help us by simply giving a star or voting on vim.org. It will ensure continued development going forward. 86 | 87 | - Star this repository [on GitHub](https://github.com/ryanoasis/vim-devicons). 88 | - Vote for it [on vim.org](http://www.vim.org/scripts/script.php?script_id=5114). 89 | 90 | Acknowledgments 91 | --------------- 92 | 93 | Thanks goes to these people for inspiration and helping with sending PRs. 94 | 95 | - [vim-airline](https://github.com/vim-airline/vim-airline) 96 | - [nerdtree](https://github.com/preservim/nerdtree) 97 | - [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin) by [@Xuyuanp](https://github.com/Xuyuanp) 98 | - [seti-ui](https://atom.io/themes/seti-ui) by [@jesseweed](https://github.com/jesseweed) 99 | - [devicons](http://vorillaz.github.io/devicons) by [@vorillaz](https://github.com/vorillaz) 100 | - [development.svg.icons](https://github.com/benatespina/development.svg.icons) by [@benatespina](https://github.com/benatespina) 101 | - [Learn Vimscript the Hard Way](http://learnvimscriptthehardway.stevelosh.com/) book by [Steve Losh](http://stevelosh.com/) 102 | - All [contributors](https://github.com/ryanoasis/vim-devicons/graphs/contributors) 103 | 104 | License 105 | ------- 106 | 107 | [MIT](LICENSE) 108 | -------------------------------------------------------------------------------- /autoload/airline/extensions/tabline/formatters/webdevicons.vim: -------------------------------------------------------------------------------- 1 | " Version: 0.11.0 2 | " Webpage: https://github.com/ryanoasis/vim-devicons 3 | " Maintainer: Ryan McIntyre 4 | " License: see LICENSE 5 | 6 | function! airline#extensions#tabline#formatters#webdevicons#format(bufnr, buffers) abort 7 | " Call original formatter. 8 | let originalFormatter = airline#extensions#tabline#formatters#{g:_webdevicons_airline_orig_formatter}#format(a:bufnr, a:buffers) 9 | return originalFormatter . g:WebDevIconsTabAirLineBeforeGlyphPadding . 10 | \ WebDevIconsGetFileTypeSymbol(bufname(a:bufnr)) . g:WebDevIconsTabAirLineAfterGlyphPadding 11 | endfunction 12 | 13 | " modeline syntax: 14 | " vim: fdm=marker tabstop=2 softtabstop=2 shiftwidth=2 expandtab: 15 | -------------------------------------------------------------------------------- /autoload/devicons/plugins/ctrlp.vim: -------------------------------------------------------------------------------- 1 | " Initialize for up to date ctrlp fork: ctrlpvim/ctrlp.vim 2 | " Support for kien/ctrlp.vim deprecated since v0.7.0 3 | " @TODO implementation for CtrlP buffer and find file mode 4 | 5 | function! devicons#plugins#ctrlp#init() abort 6 | let l:ctrlp_warning_message = 'vim-devicons: https://github.com/kien/ctrlp.vim is deprecated since v0.7.0, please use https://github.com/ctrlpvim/ctrlp.vim' 7 | let l:ctrlp_warned_file = webdevicons#pluginHome() . '/status_warned_ctrlp' 8 | 9 | if exists('g:loaded_ctrlp') && g:webdevicons_enable_ctrlp 10 | let l:forkedCtrlp = exists('g:ctrlp_mruf_map_string') 11 | 12 | if l:forkedCtrlp 13 | if !exists('g:ctrlp_formatline_func') 14 | " logic for ctrlpvim/ctrlp.vim: 15 | let g:ctrlp_formatline_func = 's:formatline(s:curtype() == "buf" ? v:val : WebDevIconsGetFileTypeSymbol(v:val) . " " . v:val) ' 16 | endif 17 | elseif empty(glob(l:ctrlp_warned_file)) 18 | " logic for kien/ctrlp.vim: 19 | echohl WarningMsg | 20 | \ echomsg l:ctrlp_warning_message 21 | " only warn first time, do not warn again: 22 | try 23 | execute writefile(['File automatically generated after warning about CtrlP once', l:ctrlp_warning_message], l:ctrlp_warned_file) 24 | catch 25 | endtry 26 | endif 27 | endif 28 | endfunction 29 | 30 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab: 31 | -------------------------------------------------------------------------------- /autoload/devicons/plugins/denite.vim: -------------------------------------------------------------------------------- 1 | function! devicons#plugins#denite#init() abort 2 | let s:denite_ver = (exists('*denite#get_status_mode') ? 2 : 3) 3 | if s:denite_ver == 3 4 | call denite#custom#source('file,file/rec,file_mru,file/old,buffer,directory/rec,directory_mru', 'converters', ['devicons_denite_converter']) 5 | else 6 | call denite#custom#source('file,file_rec,file_mru,file_old,buffer,directory_rec,directory_mru', 'converters', ['devicons_denite_converter']) 7 | endif 8 | endfunction 9 | 10 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab: 11 | -------------------------------------------------------------------------------- /autoload/devicons/plugins/flagship.vim: -------------------------------------------------------------------------------- 1 | function! devicons#plugins#flagship#init() abort 2 | if g:webdevicons_enable_flagship_statusline 3 | augroup webdevicons_flagship_filetype 4 | autocmd User Flags call Hoist('buffer', 'WebDevIconsGetFileTypeSymbol') 5 | augroup END 6 | endif 7 | 8 | if g:webdevicons_enable_flagship_statusline_fileformat_symbols 9 | augroup webdevicons_flagship_filesymbol 10 | autocmd User Flags call Hoist('buffer', 'WebDevIconsGetFileFormatSymbol') 11 | augroup END 12 | endif 13 | endfunction 14 | 15 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab: 16 | -------------------------------------------------------------------------------- /autoload/devicons/plugins/startify.vim: -------------------------------------------------------------------------------- 1 | 2 | function! devicons#plugins#startify#init() abort 3 | exec ":function! StartifyEntryFormat() abort \n return 'WebDevIconsGetFileTypeSymbol(absolute_path) .\" \". entry_path' \n endfunction" 4 | endfunction 5 | 6 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab: 7 | -------------------------------------------------------------------------------- /autoload/devicons/plugins/unite.vim: -------------------------------------------------------------------------------- 1 | function! devicons#plugins#unite#init() abort 2 | let s:filters = { 3 | \ 'name': 'devicons_unite_converter' 4 | \ } 5 | 6 | function! s:filters.filter(candidates, context) abort 7 | for candidate in a:candidates 8 | 9 | if has_key(candidate, 'action__buffer_nr') 10 | let bufname = bufname(candidate.action__buffer_nr) 11 | let filename = fnamemodify(bufname, ':p:t') 12 | let path = fnamemodify(bufname, ':p:h') 13 | elseif has_key(candidate, 'word') && has_key(candidate, 'action__path') 14 | let path = candidate.action__path 15 | let filename = candidate.word 16 | endif 17 | 18 | let icon = WebDevIconsGetFileTypeSymbol(filename, isdirectory(filename)) 19 | 20 | " prevent filenames of buffers getting 'lost' 21 | if filename != path 22 | let path = printf('%s', filename) 23 | endif 24 | 25 | " Customize output format. 26 | let candidate.abbr = printf('%s %s', icon, path) 27 | endfor 28 | return a:candidates 29 | endfunction 30 | 31 | call unite#define_filter(s:filters) 32 | unlet s:filters 33 | 34 | call unite#custom#source('file,file_rec,buffer,file_rec/async,file_rec/neovim,file_rec/neovim2,file_rec/git', 'converters', 'devicons_unite_converter') 35 | endfunction 36 | 37 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab: 38 | -------------------------------------------------------------------------------- /autoload/devicons/plugins/vimfiler.vim: -------------------------------------------------------------------------------- 1 | function! devicons#plugins#vimfiler#init() abort 2 | call vimfiler#custom#profile('default', 'context', { 3 | \ 'columns': 'devicons:size:time', 4 | \ 'explorer_columns': 'devicons' 5 | \ }) 6 | endfunction 7 | 8 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab: 9 | -------------------------------------------------------------------------------- /autoload/vimfiler/columns/devicons.vim: -------------------------------------------------------------------------------- 1 | "============================================================================= 2 | " FILE: devicons.vim 3 | " Version: 0.11.0 4 | " Webpage: https://github.com/ryanoasis/vim-devicons 5 | " Maintainer: Ryan McIntyre 6 | " License: MIT license {{{ 7 | " Permission is hereby granted, free of charge, to any person obtaining 8 | " a copy of this software and associated documentation files (the 9 | " "Software"), to deal in the Software without restriction, including 10 | " without limitation the rights to use, copy, modify, merge, publish, 11 | " distribute, sublicense, and/or sell copies of the Software, and to 12 | " permit persons to whom the Software is furnished to do so, subject to 13 | " the following conditions: 14 | " 15 | " The above copyright notice and this permission notice shall be included 16 | " in all copies or substantial portions of the Software. 17 | " 18 | " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | " }}} 26 | "============================================================================= 27 | 28 | let s:save_cpo = &cpo 29 | set cpo&vim 30 | 31 | function! vimfiler#columns#devicons#define() abort 32 | return s:column 33 | endfunction 34 | 35 | let s:column = { 36 | \ 'name' : 'devicons', 37 | \ 'description' : 'get devicon glyph', 38 | \ 'syntax' : 'vimfilerColumn__devicons', 39 | \ } 40 | 41 | function! s:column.length(files, context) abort 42 | return 3 43 | endfunction 44 | 45 | function! s:column.define_syntax(context) abort "{{{ 46 | syntax match vimfilerColumn__TypeText '\[T\]' 47 | \ contained containedin=vimfilerColumn__Type 48 | syntax match vimfilerColumn__TypeImage '\[I\]' 49 | \ contained containedin=vimfilerColumn__Type 50 | syntax match vimfilerColumn__TypeArchive '\[A\]' 51 | \ contained containedin=vimfilerColumn__Type 52 | syntax match vimfilerColumn__TypeExecute '\[X\]' 53 | \ contained containedin=vimfilerColumn__Type 54 | syntax match vimfilerColumn__TypeMultimedia '\[M\]' 55 | \ contained containedin=vimfilerColumn__Type 56 | syntax match vimfilerColumn__TypeDirectory '\[do\]' 57 | \ contained containedin=vimfilerColumn__Type 58 | syntax match vimfilerColumn__TypeSystem '\[S\]' 59 | \ contained containedin=vimfilerColumn__Type 60 | syntax match vimfilerColumn__TypeLink '\[L\]' 61 | \ contained containedin=vimfilerColumn__Type 62 | 63 | highlight def link vimfilerColumn__TypeText Constant 64 | highlight def link vimfilerColumn__TypeImage Type 65 | highlight def link vimfilerColumn__TypeArchive Special 66 | highlight def link vimfilerColumn__TypeExecute Statement 67 | highlight def link vimfilerColumn__TypeMultimedia Identifier 68 | highlight def link vimfilerColumn__TypeDirectory Preproc 69 | highlight def link vimfilerColumn__TypeSystem Comment 70 | highlight def link vimfilerColumn__TypeLink Comment 71 | endfunction"}}} 72 | 73 | function! s:column.get(file, context) abort 74 | return WebDevIconsGetFileTypeSymbol(strpart(a:file.action__path, strridx(a:file.action__path, '/')), a:file.vimfiler__is_directory) 75 | endfunction 76 | 77 | let &cpo = s:save_cpo 78 | unlet s:save_cpo 79 | 80 | " vim: foldmethod=marker 81 | -------------------------------------------------------------------------------- /doc/webdevicons.txt: -------------------------------------------------------------------------------- 1 | *devicons* 2 | 3 | =============================================================================== 4 | Contents ~ 5 | 6 | 1. Introduction |devicons-introduction| 7 | 2. Features |devicons-features| 8 | 3. Installation |devicons-installation| 9 | 4. Developers |devicons-developers| 10 | 5. Troubleshooting |devicons-troubleshooting| 11 | 6. Contributing |devicons-contributing| 12 | 1. Code of Conduct [22] |devicons-code-of-conduct-22| 13 | 2. Contributing Guide [23] |devicons-contributing-guide-23| 14 | 3. Promotion |devicons-promotion| 15 | 7. Acknowledgments |devicons-acknowledgments| 16 | 8. License |devicons-license| 17 | 9. Detailed Installation |devicons-detailed-installation| 18 | 1. Step 1 'Nerd Font' |Nerd-Font| 19 | 2. Step 2 'VimDevIcons Plugin' |VimDevIcons-Plugin| 20 | 1. Pathogen [38] |devicons-pathogen-38| 21 | 2. NeoBundle [39] |devicons-neobundle-39| 22 | 3. Vundle [40] |devicons-vundle-40| 23 | 4. Manual |devicons-manual| 24 | 3. Step 3 'Configure Vim' |Configure-Vim| 25 | 1. Set Encoding |devicons-set-encoding| 26 | 2. Set Font |devicons-set-font| 27 | 3. vim-airline |devicons-vim-airline| 28 | 4. vimrc examples |devicons-vimrc-examples| 29 | 4. That's it! You're done. |devicons-thats-it-youre-done.| 30 | 10. Usage |devicons-usage| 31 | 1. NERDTree |devicons-nerdtree| 32 | 2. Unite |devicons-unite| 33 | 3. Denite |devicons-denite| 34 | 4. Vimfiler |devicons-vimfiler| 35 | 5. CtrlP |devicons-ctrlp| 36 | 6. Airline |devicons-airline| 37 | 7. Startify |devicons-startify| 38 | 8. Lightline Setup |devicons-lightline-setup| 39 | 9. Powerline Setup |devicons-powerline-setup| 40 | 10. Flagship |devicons-flagship| 41 | 11. Detailed Features |devicons-detailed-features| 42 | 12. Extra Configuration |devicons-extra-configuration| 43 | 1. Character Mappings |devicons-character-mappings| 44 | 2. API |devicons-api| 45 | 1. Public Methods |devicons-public-methods| 46 | 2. API Examples |devicons-api-examples| 47 | 1. Status line |devicons-status-line| 48 | 2. Simple function call |devicons-simple-function-call| 49 | 3. Integration with other plugins |devicons-integration-with-other-plugins| 50 | 1. vim-startify |devicons-vim-startify| 51 | 13. FAQ |devicons-faq| 52 | 1. Why isn't it working? How come I don't see any icons? |devicons-why-isnt-it-working-how-come-i-dont-see-any-icons| 53 | 2. How did you get color matching based on file type in NERDtree? |devicons-how-did-you-get-color-matching-based-on-file-type-in-nerdtree| 54 | 3. How did you get color matching on just the glyph/icon in NERDtree? |devicons-how-did-you-get-color-matching-on-just-glyph-icon-in-nerdtree| 55 | 4. How do I solve issues after re-sourcing my |vimrc|? 56 | 5. Why do I have artifacts after (or instead) of icons? |devicons-why-do-i-have-artifacts-after-of-icons| 57 | 6. Square brackets around icons |devicons-square-brackets-around-icons| 58 | 1. from terminal |devicons-from-terminal| 59 | 7. Do I have to use a patched font such as Nerd Fonts? |devicons-do-i-have-to-use-patched-font-such-as-nerd-fonts| 60 | 8. Rationale: Why does this exist? How did this start? |devicons-rationale-why-does-this-exist-how-did-this-start| 61 | 14. References |devicons-references| 62 | 63 | =============================================================================== 64 | *devicons-introduction* 65 | Introduction ~ 66 | > 67 | _ ___ ____ ____ 68 | | | / (_____ ___ / __ \___ _ __/ _/________ ____ _____ 69 | | | / / / __ `__ \/ / / / _ | | / // // ___/ __ \/ __ \/ ___/ 70 | | |/ / / / / / / / /_/ / __| |/ _/ // /__/ /_/ / / / (__ ) 71 | |___/_/_/ /_/ /_/_____/\___/|___/___/\___/\____/_/ /_/____/ 72 | < 73 | **VimDevIcons** 74 | 75 | Adds Icons to Your Plugins 76 | 77 | Supports plugins such as NERDTree [1], vim-airline [2], CtrlP [3], powerline 78 | [4], denite [5], unite [6], lightline.vim [7], vim-startify [8], vimfiler [9], 79 | vim-workspace [10] and flagship [11]. 80 | 81 | See Screenshots [12] for more. 82 | 83 | =============================================================================== 84 | *devicons-features* 85 | Features ~ 86 | 87 | - Adds filetype glyphs (icons) to various vim plugins. 88 | - Supports byte order marker (BOM). 89 | - Customizable and extendable glyphs settings. 90 | - Supports a wide range of file type extensions. 91 | - Supports popular full filenames, like '.gitignore', 'node_modules', 92 | '.vimrc'. 93 | - Works with patched fonts, especially Nerd Fonts [13]. 94 | 95 | See Detailed Features [14] for more. 96 | 97 | See Configuration [15] for a list of configuration and customization options. 98 | 99 | =============================================================================== 100 | *devicons-installation* 101 | Installation ~ 102 | 103 | 1. Install a Nerd Font compatible font [16] or patch your own [17]. Then set 104 | your terminal font (or 'guifont' if you are using GUI version of Vim). 105 | 106 | 2. Install the Vim plugin with your favorite plugin manager, e.g. vim-plug 107 | [18]: 108 | 109 | "vim Plug 'ryanoasis/vim-devicons'" 110 | 111 | Always load the vim-devicons as the very last one. 112 | 113 | 3. Configure Vim 114 | 115 | 'vim set encoding=UTF-8' 116 | 117 | No need to set explicitly under Neovim: always uses UTF-8 as the default 118 | encoding. 119 | 120 | See Installation [19] for detailed setup instructions 121 | 122 | Use ':help devicons' for further configuration. 123 | 124 | =============================================================================== 125 | *devicons-developers* 126 | Developers ~ 127 | 128 | See DEVELOPER [20] for how to use the API. 129 | 130 | =============================================================================== 131 | *devicons-troubleshooting* 132 | Troubleshooting ~ 133 | 134 | See FAQ [21]. 135 | 136 | =============================================================================== 137 | *devicons-contributing* 138 | Contributing ~ 139 | 140 | ------------------------------------------------------------------------------- 141 | *devicons-code-of-conduct-22* 142 | Code of Conduct [22] ~ 143 | 144 | This project has adopted a Code of Conduct that we expect project participants 145 | to adhere to. Check out code of conduct [22] for further details. 146 | 147 | ------------------------------------------------------------------------------- 148 | *devicons-contributing-guide-23* 149 | Contributing Guide [23] ~ 150 | 151 | Read our contributing [23] guide to learn about how to send pull requests, 152 | creating issues properly. 153 | 154 | ------------------------------------------------------------------------------- 155 | *devicons-promotion* 156 | Promotion ~ 157 | 158 | You can help us by simply giving a star or voting on vim.org. It will ensure 159 | continued development going forward. 160 | 161 | - Star this repository on GitHub [24]. 162 | - Vote for it on vim.org [25]. 163 | 164 | =============================================================================== 165 | *devicons-acknowledgments* 166 | Acknowledgments ~ 167 | 168 | Thanks goes to these people for inspiration and helping with sending PRs. 169 | 170 | - vim-airline [2] 171 | - nerdtree [1] 172 | - nerdtree-git-plugin [26] by @Xuyuanp [27] 173 | - seti-ui [28] by @jesseweed [29] 174 | - devicons [30] by @vorillaz [31] 175 | - development.svg.icons [32] by @benatespina [33] 176 | - Learn Vimscript the Hard Way [34] book by Steve Losh [35] 177 | - All contributors [36] 178 | 179 | =============================================================================== 180 | *devicons-license* 181 | License ~ 182 | 183 | MIT [37] 184 | 185 | =============================================================================== 186 | *devicons-detailed-installation* 187 | Detailed Installation ~ 188 | 189 | ------------------------------------------------------------------------------- 190 | *Nerd-Font* 191 | Step 1 'Nerd Font' ~ 192 | 193 | Get a **Nerd Font!** [16] or patch your own. [17] Without this, things break 194 | 195 | ------------------------------------------------------------------------------- 196 | *VimDevIcons-Plugin* 197 | Step 2 'VimDevIcons Plugin' ~ 198 | 199 | **Set VimDevIcons to load _after_ these plugins!** 200 | 201 | NERDTree [1] | vim-airline [2] | CtrlP [3] | powerline [4] | Denite [5] | unite 202 | [6] | lightline.vim [7] | vim-startify [8] | vimfiler [9] | flagship [11] 203 | 204 | Choose your favorite plugin manager 205 | 206 | ------------------------------------------------------------------------------- 207 | *devicons-pathogen-38* 208 | Pathogen [38] ~ 209 | 210 | - 'git clone https://github.com/ryanoasis/vim-devicons ~/.vim/bundle/vim- 211 | devicons' 212 | 213 | ------------------------------------------------------------------------------- 214 | *devicons-neobundle-39* 215 | NeoBundle [39] ~ 216 | 217 | - Add to vimrc: 218 | 219 | "vim NeoBundle 'ryanoasis/vim-devicons'" * And install it: 220 | 221 | 'vim :so ~/.vimrc :NeoBundleInstall' 222 | 223 | ------------------------------------------------------------------------------- 224 | *devicons-vundle-40* 225 | Vundle [40] ~ 226 | 227 | - Add to vimrc: 228 | 229 | "vim Plugin 'ryanoasis/vim-devicons'" * And install it: 230 | 231 | 'vim :so ~/.vimrc :PlugInstall' 232 | 233 | ------------------------------------------------------------------------------- 234 | *devicons-manual* 235 | Manual ~ 236 | 237 | - copy all of the files into your '~/.vim' directory 238 | 239 | ------------------------------------------------------------------------------- 240 | *Configure-Vim* 241 | Step 3 'Configure Vim' ~ 242 | 243 | Add the following in your '.vimrc' or '.gvimrc': 244 | 245 | ------------------------------------------------------------------------------- 246 | *devicons-set-encoding* 247 | Set Encoding ~ 248 | 249 | **Set encoding to UTF-8 to show glyphs** 250 | 251 | 'vim set encoding=utf8' 252 | 253 | ------------------------------------------------------------------------------- 254 | *devicons-set-font* 255 | Set Font ~ 256 | 257 | **Set Vim font to a Nerd Font** 258 | 259 | Linux 'vim set guifont=' 260 | > 261 | set guifont=DroidSansMono\ Nerd\ Font\ 11 262 | < 263 | macOS (OS X) and Windows 264 | > 265 | set guifont=:h 266 | < 267 | 268 | > 269 | set guifont=DroidSansMono\ Nerd\ Font:h11 270 | " or: 271 | set guifont=DroidSansMono_Nerd_Font:h11 272 | < 273 | **Note:** if you don't set 'guifont' then you'll have to set your terminal's 274 | font, else things break! 275 | 276 | ------------------------------------------------------------------------------- 277 | *devicons-vim-airline* 278 | vim-airline ~ 279 | 280 | **If you use vim-airline you need this:** 281 | 282 | 'vim let g:airline_powerline_fonts = 1' 283 | 284 | ------------------------------------------------------------------------------- 285 | *devicons-vimrc-examples* 286 | vimrc examples ~ 287 | 288 | - Sample Windows vimrc configuration 1 [41] 289 | - Sample Linux vimrc configuration 1 [42] 290 | 291 | ------------------------------------------------------------------------------- 292 | *devicons-thats-it-youre-done.* 293 | That's it! You're done. ~ 294 | 295 | =============================================================================== 296 | *devicons-usage* 297 | Usage ~ 298 | 299 | If you installed and setup things correctly you should now see icons in the 300 | supported plugins! 301 | 302 | **Notes on include order:** _for support of these plugins: NERDTree [1], vim- 303 | airline [2], CtrlP [3], powerline [4], Denite [5], unite [6], vimfiler [9], 304 | flagship [11] you **must** configure vim to load those plugins__before_ vim- 305 | devicons loads. for better nerdtree-git-plugin [26] support, you _should_ 306 | configure vim to load nerdtree-git-plugin **_before_** VimDevIcons loads. * if 307 | you are lazy loading Denite [5] using the Dein plugin manager, you will need to 308 | source VimDevIcons before Denite loads. 309 | 310 | Lightline Setup and Powerline Setup require some extra setup as shown below: 311 | 312 | ------------------------------------------------------------------------------- 313 | *devicons-nerdtree* 314 | NERDTree ~ 315 | 316 | Should work "out of the box", no particular configuration should be needed. 317 | > 318 | " Can be enabled or disabled 319 | let g:webdevicons_enable_nerdtree = 1 320 | < 321 | 322 | > 323 | " whether or not to show the nerdtree brackets around flags 324 | let g:webdevicons_conceal_nerdtree_brackets = 1 325 | < 326 | ------------------------------------------------------------------------------- 327 | *devicons-unite* 328 | Unite ~ 329 | 330 | Should work "out of the box", no particular configuration should be needed. 331 | > 332 | " Can be enabled or disabled 333 | " adding the custom source to unite 334 | let g:webdevicons_enable_unite = 1 335 | < 336 | ------------------------------------------------------------------------------- 337 | *devicons-denite* 338 | Denite ~ 339 | 340 | Should work "out of the box", no particular configuration should be needed. 341 | > 342 | " Can be enabled or disabled 343 | " Adding the custom source to denite 344 | let g:webdevicons_enable_denite = 1 345 | < 346 | ------------------------------------------------------------------------------- 347 | *devicons-vimfiler* 348 | Vimfiler ~ 349 | 350 | Should work "out of the box", no particular configuration should be needed. 351 | > 352 | " Can be enabled or disabled 353 | " adding the column to vimfiler 354 | let g:webdevicons_enable_vimfiler = 1 355 | < 356 | ------------------------------------------------------------------------------- 357 | *devicons-ctrlp* 358 | CtrlP ~ 359 | 360 | Should work "out of the box", no particular configuration should be needed. 361 | > 362 | " Can be enabled or disabled 363 | " add glyphs to all modes 364 | let g:webdevicons_enable_ctrlp = 1 365 | < 366 | ------------------------------------------------------------------------------- 367 | *devicons-airline* 368 | Airline ~ 369 | 370 | Should work "out of the box", no particular configuration should be needed. 371 | > 372 | " adding to vim-airline's tabline 373 | let g:webdevicons_enable_airline_tabline = 1 374 | < 375 | 376 | > 377 | " adding to vim-airline's statusline 378 | let g:webdevicons_enable_airline_statusline = 1 379 | < 380 | ------------------------------------------------------------------------------- 381 | *devicons-startify* 382 | Startify ~ 383 | 384 | Should work "out of the box", no particular configuration should be needed. 385 | > 386 | " Can be enabled or disabled 387 | " adding to vim-startify screen 388 | let g:webdevicons_enable_startify = 1 389 | < 390 | ------------------------------------------------------------------------------- 391 | *devicons-lightline-setup* 392 | Lightline Setup ~ 393 | 394 | To add the appropriate icon to lightline [7], call the function 395 | 'WebDevIconsGetFileTypeSymbol()' and/or 'WebDevIconsGetFileFormatSymbol()' in 396 | your '.vimrc'. For example, you could set your sections to: 397 | > 398 | let g:lightline = { 399 | \ 'component_function': { 400 | \ 'filetype': 'MyFiletype', 401 | \ 'fileformat': 'MyFileformat', 402 | \ } 403 | \ } 404 | 405 | function! MyFiletype() 406 | return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : '' 407 | endfunction 408 | 409 | function! MyFileformat() 410 | return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : '' 411 | endfunction 412 | < 413 | ------------------------------------------------------------------------------- 414 | *devicons-powerline-setup* 415 | Powerline Setup ~ 416 | 417 | - _Note this is for the current Powerline [4] not the deprecated vim- 418 | powerline [43]_ 419 | 420 | To enable for Powerline [4] some |vimrc| and powerline configuration changes 421 | are needed: 422 | 423 | |vimrc| changes (only required if you don't already have powerline setup for 424 | vim): 425 | > 426 | set rtp+=$HOME/.local/lib/python2.7/site-packages/powerline/bindings/vim/ 427 | 428 | " Always show statusline 429 | set laststatus=2 430 | 431 | " Use 256 colours (Use this setting only if your terminal supports 256 colours) 432 | set t_Co=256 433 | < 434 | powerline configuration changes: 435 | 436 | file type segment 437 | > 438 | { 439 | "function": "vim_devicons.powerline.segments.webdevicons", 440 | "priority": 10, 441 | "draw_soft_divider": false, 442 | "after": " " 443 | } 444 | < 445 | file format segment 446 | > 447 | { 448 | "function": "vim_devicons.powerline.segments.webdevicons_file_format", 449 | "draw_soft_divider": false, 450 | "exclude_modes": ["nc"], 451 | "priority": 90 452 | } 453 | < 454 | for full example see sample file [44] 455 | 456 | ------------------------------------------------------------------------------- 457 | *devicons-flagship* 458 | Flagship ~ 459 | 460 | Should work "out of the box", no particular configuration should be needed. 461 | > 462 | " Can be enabled or disabled 463 | " adding to flagship's statusline 464 | let g:webdevicons_enable_flagship_statusline = 1 465 | < 466 | =============================================================================== 467 | *devicons-detailed-features* 468 | Detailed Features ~ 469 | 470 | - Adds filetype glyphs (icons) to various vim plugins, currently supports: 471 | 472 | - NERDTree [1] 473 | 474 | - Using the version hosted on vimscripts [45] in favor of GitHub will 475 | lead to a outdated message, and icons will fail to show. 476 | 477 | - vim-airline [2] (statusline and tabline) 478 | 479 | - CtrlP [3] (All modes now supported) 480 | 481 | - Using the version hosted on vimscripts [46] in favor of GitHub will 482 | lead to a outdated message, and icons will fail to show. 483 | 484 | - powerline [4] (statusline) 485 | 486 | - see: powerline setup 487 | 488 | - Denite [5] 489 | 490 | - Currently supports 'file_rec', 'file_old', 'buffer', and 491 | 'directory_rec' 492 | 493 | - unite [6] 494 | 495 | - Currently supports 'file', 'file_rec', 'buffer', 'file_rec/async', and 496 | 'file_rec/neovim' 497 | 498 | - lightline.vim [7] (statusline) 499 | 500 | - see: lightline setup 501 | 502 | - vim-startify [8] 503 | 504 | - vimfiler [9] 505 | 506 | - flagship [11] 507 | 508 | - Support is **experimental** because the API may be changing [47] 509 | 510 | - vim-workspace [10] 511 | 512 | - Supports byte order marker (BOM) 513 | 514 | - Customizable and extendable glyphs (icons) settings 515 | 516 | - ability to override defaults and use your own characters or glyphs 517 | 518 | - Supports a wide range of file type extensions by default: 519 | 520 | - 'styl, sass, scss, htm, html, slim, ejs, css, less, md, rmd, json, js, jsx, 521 | rb, php, py, pyc, pyd, pyo, coffee, mustache, hbs, conf, ini, yml, yaml, 522 | bat, jpg, jpeg, bmp, png, gif, twig, cpp, c++, cxx, cc, cp, c, h, hpp, hxx, 523 | hs, lhs, lua, java, sh, bash, zsh, ksh, csh, awk, ps1, fish, diff, db, clj, 524 | cljs, edn, scala, go, dart, xul, sln, suo, pl, pm, t, rss, f#, fsscript, 525 | fsx, fs, fsi, rs, rlib, d, erl, hrl, vim, ai, psd, psb, ts, jl, pp, vue, 526 | swift, eex, ex, exs' 527 | 528 | - Supports a few full filename matches, by default: 529 | 530 | - 'gruntfile.coffee, gruntfile.js, gruntfile.ls, gulpfile.coffee, 531 | gulpfile.js, gulpfile.ls, dropbox, .ds_store, .gitconfig, .gitignore, 532 | .bashrc, .zshrc, .vimrc, .bashprofile, favicon.ico, license, node_modules, 533 | react.jsx, procfile' 534 | 535 | - Supports a few library pattern matches, by default: 536 | 537 | - 'jquery, angular, backbone, requirejs, materialize, mootools, Vagrantfile' 538 | 539 | - Works with patched fonts, especially Nerd Fonts [13] 540 | 541 | =============================================================================== 542 | *devicons-extra-configuration* 543 | Extra Configuration ~ 544 | 545 | - These options can be defined in your |vimrc| or 'gvimrc' 546 | 547 | - Most options are enabled **'1'** by default but can be disabled with 548 | **'0'** 549 | 550 | - You _should_**not** need to configure anything, however, the following 551 | options are provided for customizing or changing the defaults: 552 | > 553 | " loading the plugin 554 | let g:webdevicons_enable = 1 555 | < 556 | 557 | > 558 | " adding the flags to NERDTree 559 | let g:webdevicons_enable_nerdtree = 1 560 | < 561 | 562 | > 563 | " adding the custom source to unite 564 | let g:webdevicons_enable_unite = 1 565 | < 566 | 567 | > 568 | " adding the column to vimfiler 569 | let g:webdevicons_enable_vimfiler = 1 570 | < 571 | 572 | > 573 | " adding to vim-airline's tabline 574 | let g:webdevicons_enable_airline_tabline = 1 575 | < 576 | 577 | > 578 | " adding to vim-airline's statusline 579 | let g:webdevicons_enable_airline_statusline = 1 580 | < 581 | 582 | > 583 | " ctrlp glyphs 584 | let g:webdevicons_enable_ctrlp = 1 585 | < 586 | 587 | > 588 | " adding to vim-startify screen 589 | let g:webdevicons_enable_startify = 1 590 | < 591 | 592 | > 593 | " adding to flagship's statusline 594 | let g:webdevicons_enable_flagship_statusline = 1 595 | < 596 | 597 | > 598 | " turn on/off file node glyph decorations (not particularly useful) 599 | let g:WebDevIconsUnicodeDecorateFileNodes = 1 600 | < 601 | 602 | > 603 | " use double-width(1) or single-width(0) glyphs 604 | " only manipulates padding, has no effect on terminal or set(guifont) font 605 | let g:WebDevIconsUnicodeGlyphDoubleWidth = 1 606 | < 607 | 608 | > 609 | " whether or not to show the nerdtree brackets around flags 610 | let g:webdevicons_conceal_nerdtree_brackets = 1 611 | < 612 | 613 | > 614 | " the amount of space to use after the glyph character (default ' ') 615 | let g:WebDevIconsNerdTreeAfterGlyphPadding = ' ' 616 | < 617 | 618 | > 619 | " Force extra padding in NERDTree so that the filetype icons line up vertically 620 | let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1 621 | < 622 | 623 | > 624 | " Adding the custom source to denite 625 | let g:webdevicons_enable_denite = 1 626 | 627 | 628 | 629 | " the amount of space to use after the glyph character in vim-airline 630 | tabline(default '') 631 | let g:WebDevIconsTabAirLineAfterGlyphPadding = ' ' 632 | 633 | 634 | 635 | " the amount of space to use before the glyph character in vim-airline 636 | tabline(default ' ') 637 | let g:WebDevIconsTabAirLineBeforeGlyphPadding = ' ' 638 | < 639 | ------------------------------------------------------------------------------- 640 | *devicons-character-mappings* 641 | Character Mappings ~ 642 | 643 | - 'ƛ' is used as an example below, substitute for the glyph you **actually** 644 | want to use 645 | > 646 | " change the default character when no match found 647 | let g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol = 'ƛ' 648 | < 649 | 650 | > 651 | " set a byte character marker (BOM) utf-8 symbol when retrieving file encoding 652 | " disabled by default with no value 653 | let g:WebDevIconsUnicodeByteOrderMarkerDefaultSymbol = '' 654 | < 655 | 656 | > 657 | " enable folder/directory glyph flag (disabled by default with 0) 658 | let g:WebDevIconsUnicodeDecorateFolderNodes = 1 659 | < 660 | 661 | > 662 | " enable open and close folder/directory glyph flags (disabled by default with 0) 663 | let g:DevIconsEnableFoldersOpenClose = 1 664 | < 665 | 666 | > 667 | " enable pattern matching glyphs on folder/directory (enabled by default with 1) 668 | let g:DevIconsEnableFolderPatternMatching = 1 669 | < 670 | 671 | > 672 | " enable file extension pattern matching glyphs on folder/directory (disabled by default with 0) 673 | let g:DevIconsEnableFolderExtensionPatternMatching = 0 674 | < 675 | 676 | > 677 | " disable showing the distribution for unix file encoding (enabled by default with 1) 678 | let g:DevIconsEnableDistro = 0 679 | < 680 | 681 | > 682 | " enable custom folder/directory glyph exact matching 683 | " (enabled by default when g:WebDevIconsUnicodeDecorateFolderNodes is set to 1) 684 | let WebDevIconsUnicodeDecorateFolderNodesExactMatches = 1 685 | < 686 | 687 | > 688 | " change the default folder/directory glyph/icon 689 | let g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol = 'ƛ' 690 | < 691 | 692 | > 693 | " change the default open folder/directory glyph/icon (default is '') 694 | let g:DevIconsDefaultFolderOpenSymbol = 'ƛ' 695 | < 696 | 697 | > 698 | " change the default dictionary mappings for file extension matches 699 | 700 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} " needed 701 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['js'] = 'ƛ' 702 | < 703 | 704 | > 705 | " change the default dictionary mappings for exact file node matches 706 | 707 | let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols = {} " needed 708 | let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols['MyReallyCoolFile.okay'] = 'ƛ' 709 | < 710 | 711 | > 712 | " add or override individual additional filetypes 713 | 714 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} " needed 715 | let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['myext'] = 'ƛ' 716 | < 717 | 718 | > 719 | " add or override pattern matches for filetypes 720 | " these take precedence over the file extensions 721 | 722 | let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols = {} " needed 723 | let g:WebDevIconsUnicodeDecorateFileNodesPatternSymbols['.*jquery.*\.js$'] = 'ƛ' 724 | < 725 | specify OS to decide an icon for unix fileformat (_not_ defined by default) - 726 | this is useful for avoiding unnecessary 'system()' call. see #135 [48] for 727 | further details. 728 | > 729 | let g:WebDevIconsOS = 'Darwin' 730 | < 731 | ------------------------------------------------------------------------------- 732 | *devicons-api* 733 | API ~ 734 | > 735 | " returns the font character that represents the icon 736 | " parameters: a:1 (filename), a:2 (isDirectory) 737 | " both parameters optional 738 | " by default without parameters uses buffer name 739 | WebDevIconsGetFileTypeSymbol(...) 740 | 741 | " returns the font character that represents 742 | " the file format as an icon (windows, linux, mac) 743 | WebDevIconsGetFileFormatSymbol() 744 | < 745 | ------------------------------------------------------------------------------- 746 | *devicons-public-methods* 747 | Public Methods ~ 748 | > 749 | " Returns the current version of the plugin 750 | webdevicons#version() 751 | < 752 | 753 | > 754 | " Calls webdevicons#softRefresh() 755 | " basically a backwards compatibility convenience 756 | webdevicons#refresh() 757 | < 758 | 759 | > 760 | " Does a 'hard' refresh of NERDTree 761 | " resets vim-devicons syntax and closes and reopens NERDTree 762 | webdevicons#hardRefresh() 763 | < 764 | 765 | > 766 | " Does a 'soft' refresh of NERDTree 767 | " resets vim-devicons syntax and toggles NERDTree to the same state 768 | webdevicons#softRefresh() 769 | < 770 | ------------------------------------------------------------------------------- 771 | *devicons-api-examples* 772 | API Examples ~ 773 | 774 | ------------------------------------------------------------------------------- 775 | *devicons-status-line* 776 | Status line ~ 777 | 778 | Custom vim status line (not relying on vim-airline or lightline): 779 | > 780 | set statusline=%f\ %{WebDevIconsGetFileTypeSymbol()}\ %h%w%m%r\ %=%(%l,%c%V\ %Y\ %=\ %P%) 781 | < 782 | ------------------------------------------------------------------------------- 783 | *devicons-simple-function-call* 784 | Simple function call ~ 785 | > 786 | echo WebDevIconsGetFileFormatSymbol() 787 | < 788 | ------------------------------------------------------------------------------- 789 | *devicons-integration-with-other-plugins* 790 | Integration with other plugins ~ 791 | 792 | ------------------------------------------------------------------------------- 793 | *devicons-vim-startify* 794 | vim-startify ~ 795 | > 796 | let entry_format = "' ['. index .']'. repeat(' ', (3 - strlen(index)))" 797 | 798 | if exists('*WebDevIconsGetFileTypeSymbol') " support for vim-devicons 799 | let entry_format .= ". WebDevIconsGetFileTypeSymbol(entry_path) .' '. entry_path" 800 | else 801 | let entry_format .= '. entry_path' 802 | endif 803 | < 804 | =============================================================================== 805 | *devicons-faq* 806 | FAQ ~ 807 | 808 | **Table of Contents:** 809 | 810 | **It's not working at all:** 811 | 812 | - **Why isn't it working? How come I don't see any icons?** 813 | 814 | **Syntax or color highlighting:** 815 | 816 | - **How did you get color matching based on file type in NERDtree?** 817 | - **How did you get color matching on just the glyph/icon in NERDtree?** 818 | 819 | **Re-sourcing |vimrc|:** 820 | 821 | - **How do I solve issues after re-sourcing my |vimrc|?** 822 | 823 | **Weird artifacts after/on the glyphs:** 824 | 825 | - **Why do I have artifacts after (or instead) of icons?** 826 | - **Square brackets around icons?** 827 | 828 | **Fonts:** 829 | 830 | - **Do I have to use a patched font such as Nerd Fonts?** 831 | 832 | **Why does this exist? How did this start?** 833 | 834 | ------------------------------------------------------------------------------- 835 | *devicons-why-isnt-it-working-how-come-i-dont-see-any-icons* 836 | Why isn't it working? How come I don't see any icons? ~ 837 | 838 | - Are you using the patched font provided in the separate repo (Nerd Fonts 839 | [13]) or are you patching your own? 840 | 841 | - _NOTE:_ if running vim and no font set it will default to the terminal font 842 | that is set 843 | 844 | - check what the vim/gvim font is set to, from ex mode: 845 | 846 | 'vim :set guifont?' 847 | 848 | - check if the plugin is loaded (should give '1'), from ex mode: 849 | 850 | 'vim :echo loaded_webdevicons' 851 | 852 | - check if the plugin is enabled (should give '1'), from ex mode: 853 | 854 | 'vim :echo g:webdevicons_enable' 855 | 856 | - check if the plugin is enabled for NERDTree (should give '1'), from ex 857 | mode: 858 | 859 | - this should _NOT_ need to be set under normal circumstances 860 | 861 | 'vim :echo g:webdevicons_enable_nerdtree' 862 | 863 | - check if you are able to see the characters, from ex mode: 864 | 865 | 'vim :echo g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol' 866 | 867 | - if all this looks correct you may try this to see if any files show flags 868 | 869 | - last resort, see if you can even set the default symbol and have it 870 | display anywhere (NERDTree, vim-airline's statusline, vim-airlines's 871 | tabline), from ex mode: 872 | 873 | "vim :let g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol='x'" 874 | 875 | ------------------------------------------------------------------------------- 876 | *devicons-how-did-you-get-color-matching-based-on-file-type-in-nerdtree* 877 | How did you get color matching based on file type in NERDtree? ~ 878 | 879 | - You can either use this additional plugin: vim-nerdtree-syntax-highlight 880 | [49] created by @tiagofumo [50] 881 | 882 | - Or you can use my current settings from: 883 | https://github.com/scrooloose/nerdtree/issues/201#issuecomment-9954740 884 | 885 | ```vim " NERDTress File highlighting function! 886 | NERDTreeHighlightFile(extension, fg, bg, guifg, guibg) exec 'autocmd 887 | FileType nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' 888 | ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg exec 'autocmd 889 | FileType nerdtree syn match ' . a:extension .' #^\s+.*'. a:extension .'$#' 890 | endfunction 891 | 892 | call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515') 893 | call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515') 894 | call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515') call 895 | NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515') call 896 | NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515') call 897 | NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515') call 898 | NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515') call 899 | NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515') call 900 | NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515') call 901 | NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515') call 902 | NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515') call 903 | NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515') call 904 | NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515') call 905 | NERDTreeHighlightFile('ds_store', 'Gray', 'none', '#686868', '#151515') 906 | call NERDTreeHighlightFile('gitconfig', 'Gray', 'none', '#686868', 907 | '#151515') call NERDTreeHighlightFile('gitignore', 'Gray', 'none', 908 | '#686868', '#151515') call NERDTreeHighlightFile('bashrc', 'Gray', 'none', 909 | '#686868', '#151515') call NERDTreeHighlightFile('bashprofile', 'Gray', 910 | 'none', '#686868', '#151515') 'Note: If the colors still are not 911 | highlighting, try invoking such as:' autocmd VimEnter * call 912 | NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515') ``` per: 913 | https://github.com/ryanoasis/vim-devicons/issues/49#issuecomment-101753558 914 | 915 | ------------------------------------------------------------------------------- 916 | *devicons-how-did-you-get-color-matching-on-just-glyph-icon-in-nerdtree* 917 | How did you get color matching on just the glyph/icon in NERDtree? ~ 918 | 919 | - You can add something like this to your |vimrc| 920 | 921 | ```vim " NERDTress File highlighting only the glyph/icon " test highlight 922 | just the glyph (icons) in nerdtree: autocmd filetype nerdtree highlight 923 | haskell_icon ctermbg=none ctermfg=Red guifg=#ffa500 autocmd filetype 924 | nerdtree highlight html_icon ctermbg=none ctermfg=Red guifg=#ffa500 autocmd 925 | filetype nerdtree highlight go_icon ctermbg=none ctermfg=Red guifg=#ffa500 926 | 927 | autocmd filetype nerdtree syn match haskell_icon ## 928 | containedin=NERDTreeFile " if you are using another syn highlight for a 929 | given line (e.g. " NERDTreeHighlightFile) need to give that name in the 930 | 'containedin' for this " other highlight to work with it autocmd filetype 931 | nerdtree syn match html_icon ## containedin=NERDTreeFile,html autocmd 932 | filetype nerdtree syn match go_icon ## containedin=NERDTreeFile ``` 933 | 934 | ------------------------------------------------------------------------------- 935 | How do I solve issues after re-sourcing my *vimrc*? 936 | 937 | - Try adding this to the bottom of your |vimrc| 938 | 939 | 'vim if exists("g:loaded_webdevicons") call webdevicons#refresh() endif' 940 | 941 | ------------------------------------------------------------------------------- 942 | *devicons-why-do-i-have-artifacts-after-of-icons* 943 | Why do I have artifacts after (or instead) of icons? ~ 944 | 945 | - Dots after icons in NERDTree (on GVim), try: 946 | 947 | 'vim autocmd FileType nerdtree setlocal nolist' 948 | 949 | source: Issue #110 [51] 950 | 951 | - Newly created files in NERDTree are slow to show the glyph (icon) 952 | - check your current setting of ':updatetime?' 953 | - try setting 'updatetime' in your |vimrc| to a lower value like '250', for 954 | more info see: Issue #153 [52] 955 | 956 | ------------------------------------------------------------------------------- 957 | *devicons-square-brackets-around-icons* 958 | Square brackets around icons ~ 959 | 960 | - By default if your Vim supports conceal you should not see these, debug 961 | steps: 962 | 963 | - Check if the plugin feature is set (should be '1'): 964 | 965 | 'vim echo g:webdevicons_conceal_nerdtree_brackets' 966 | 967 | - Check that your vim was compiled with the 'conceal' feature (should be 968 | '+conceal'): 969 | 970 | ```shell 971 | 972 | ------------------------------------------------------------------------------- 973 | *devicons-from-terminal* 974 | from terminal ~ 975 | 976 | vim --version | grep conceal ``` 977 | 978 | - Check the 'conceallevel' (should be '3'): 979 | 980 | 'vim set conceallevel?' 981 | 982 | ------------------------------------------------------------------------------- 983 | *devicons-do-i-have-to-use-patched-font-such-as-nerd-fonts* 984 | Do I have to use a patched font such as Nerd Fonts? ~ 985 | 986 | VimDevIcons was desired to work with Nerd Fonts [13], however you do _not_ have 987 | to use a patched font or even Nerd Fonts specified glyphs. You have 2 main 988 | options: 989 | 990 | fontconfig fallback 991 | 992 | 1. Install the NERD Font symbol fonts: 993 | 994 | 2. Symbols Nerd Font:style=1000-em [53] 995 | 996 | 3. Symbols Nerd Font:style=2048-em [54] 997 | 998 | 4. Install 10-nerd-font-symbols.conf [55] for Fontconfig 999 | 1000 | 5. for additional information see: Issue #124 [56] and [Nerd Fonts 1001 | 'fontconfig'] 1002 | 1003 | Use your own glyph codepoints 1004 | 1005 | - specify your own glyphs and/or use your own font (see: Character Mappings 1006 | [57]) 1007 | 1008 | ------------------------------------------------------------------------------- 1009 | *devicons-rationale-why-does-this-exist-how-did-this-start* 1010 | Rationale: Why does this exist? How did this start? ~ 1011 | 1012 | After seeing the awesome theme for Atom (seti-ui) and the awesome plugins work 1013 | done for NERDTree and vim-airline and wanting something like this for Vim I 1014 | decided to create my first plugin. 1015 | 1016 | =============================================================================== 1017 | *devicons-references* 1018 | References ~ 1019 | 1020 | [1] https://github.com/scrooloose/nerdtree 1021 | [2] https://github.com/vim-airline/vim-airline 1022 | [3] https://github.com/ctrlpvim/ctrlp.vim 1023 | [4] https://github.com/powerline/powerline 1024 | [5] https://github.com/Shougo/denite.nvim 1025 | [6] https://github.com/Shougo/unite.vim 1026 | [7] https://github.com/itchyny/lightline.vim 1027 | [8] https://github.com/mhinz/vim-startify 1028 | [9] https://github.com/Shougo/vimfiler.vim 1029 | [10] https://github.com/bagrat/vim-workspace 1030 | [11] https://github.com/tpope/vim-flagship 1031 | [12] https://github.com/ryanoasis/vim-devicons/wiki/screenshots 1032 | [13] https://github.com/ryanoasis/nerd-fonts 1033 | [14] https://github.com/ryanoasis/vim-devicons/wiki/Detailed-Features 1034 | [15] https://github.com/ryanoasis/vim-devicons/wiki/Extra-Configuration 1035 | [16] https://github.com/ryanoasis/nerd-fonts#font-installation 1036 | [17] https://github.com/ryanoasis/nerd-fonts#font-patcher 1037 | [18] https://github.com/junegunn/vim-plug 1038 | [19] https://github.com/ryanoasis/vim-devicons/wiki/Installation 1039 | [20] DEVELOPER.md 1040 | [21] https://github.com/ryanoasis/vim-devicons/wiki/FAQ-&-Troubleshooting 1041 | [22] CODE_OF_CONDUCT.md 1042 | [23] CONTRIBUTING.md 1043 | [24] https://github.com/ryanoasis/vim-devicons 1044 | [25] http://www.vim.org/scripts/script.php?script_id=5114 1045 | [26] https://github.com/Xuyuanp/nerdtree-git-plugin 1046 | [27] https://github.com/Xuyuanp 1047 | [28] https://atom.io/themes/seti-ui 1048 | [29] https://github.com/jesseweed 1049 | [30] http://vorillaz.github.io/devicons 1050 | [31] https://github.com/vorillaz 1051 | [32] https://github.com/benatespina/development.svg.icons 1052 | [33] https://github.com/benatespina 1053 | [34] http://learnvimscriptthehardway.stevelosh.com/ 1054 | [35] http://stevelosh.com/ 1055 | [36] https://github.com/ryanoasis/vim-devicons/graphs/contributors 1056 | [37] LICENSE 1057 | [38] https://github.com/tpope/vim-pathogen 1058 | [39] https://github.com/Shougo/neobundle.vim 1059 | [40] https://github.com/gmarik/vundle 1060 | [41] https://github.com/ryanoasis/vim-devicons/wiki/samples/v0.10.x/.vimrc-windows-1 1061 | [42] https://github.com/ryanoasis/vim-devicons/wiki/samples/v0.10.x/.vimrc-linux-1 1062 | [43] https://github.com/Lokaltog/vim-powerline 1063 | [44] https://github.com/ryanoasis/vim-devicons/wiki/samples/v0.10.x/powerline/themes/vim/default.json 1064 | [45] http://www.vim.org/scripts/script.php?script_id=1658 1065 | [46] http://www.vim.org/scripts/script.php?script_id=3736 1066 | [47] https://github.com/tpope/vim-flagship/issues/6#issuecomment-116121220 1067 | [48] https://github.com/ryanoasis/vim-devicons/pull/135 1068 | [49] https://github.com/tiagofumo/vim-nerdtree-syntax-highlight 1069 | [50] https://github.com/tiagofumo 1070 | [51] https://github.com/ryanoasis/vim-devicons/issues/110#issue-103801335 1071 | [52] https://github.com/ryanoasis/vim-devicons/issues/153 1072 | [53] https://github.com/ryanoasis/nerd-fonts/blob/master/src/glyphs/Symbols-1000-em%20Nerd%20Font%20Complete.ttf 1073 | [54] https://github.com/ryanoasis/nerd-fonts/blob/master/src/glyphs/Symbols-2048-em%20Nerd%20Font%20Complete.ttf 1074 | [55] https://github.com/ryanoasis/nerd-fonts/blob/master/10-nerd-font-symbols.conf 1075 | [56] https://github.com/ryanoasis/vim-devicons/issues/124 1076 | [57] https://github.com/ryanoasis/vim-devicons#character-mappings 1077 | 1078 | vim: ft=help 1079 | -------------------------------------------------------------------------------- /nerdtree_plugin/webdevicons.vim: -------------------------------------------------------------------------------- 1 | " Version: 0.11.0 2 | " Webpage: https://github.com/ryanoasis/vim-devicons 3 | " Maintainer: Ryan McIntyre 4 | " License: see LICENSE 5 | 6 | " @todo fix duplicate global variable initialize here: 7 | if !exists('g:webdevicons_enable') 8 | let g:webdevicons_enable = 1 9 | endif 10 | 11 | if !exists('g:webdevicons_enable_nerdtree') 12 | let g:webdevicons_enable_nerdtree = 1 13 | endif 14 | 15 | if !exists('g:DevIconsEnableFoldersOpenClose') 16 | let g:DevIconsEnableFoldersOpenClose = 0 17 | endif 18 | 19 | if !exists('g:DevIconsEnableFolderPatternMatching') 20 | let g:DevIconsEnableFolderPatternMatching = 1 21 | endif 22 | 23 | if !exists('g:DevIconsEnableFolderExtensionPatternMatching') 24 | let g:DevIconsEnableFolderExtensionPatternMatching = 0 25 | endif 26 | 27 | " end @todo duplicate global variables 28 | 29 | " Temporary (hopefully) fix for glyph issues in gvim (proper fix is with the 30 | " actual font patcher) 31 | if !exists('g:webdevicons_gui_glyph_fix') 32 | if has('gui_running') 33 | let g:webdevicons_gui_glyph_fix = 1 34 | else 35 | let g:webdevicons_gui_glyph_fix = 0 36 | endif 37 | endif 38 | 39 | if !exists('g:DevIconsEnableNERDTreeRedraw') 40 | if has('gui_running') 41 | let g:DevIconsEnableNERDTreeRedraw = 1 42 | else 43 | let g:DevIconsEnableNERDTreeRedraw = 0 44 | endif 45 | endif 46 | 47 | if g:webdevicons_enable_nerdtree == 1 48 | if !exists('g:loaded_nerd_tree') 49 | echohl WarningMsg | 50 | \ echomsg 'vim-webdevicons requires NERDTree to be loaded before vim-webdevicons.' 51 | endif 52 | 53 | if exists('g:loaded_nerd_tree') && g:loaded_nerd_tree == 1 && !exists('g:NERDTreePathNotifier') 54 | let g:webdevicons_enable_nerdtree = 0 55 | echohl WarningMsg | 56 | \ echomsg 'vim-webdevicons requires a newer version of NERDTree to show glyphs in NERDTree - consider updating NERDTree.' 57 | endif 58 | 59 | " @todo I don't even want this to execute UNLESS the user has the 60 | " 'nerdtree-git-plugin' INSTALLED (not LOADED) 61 | " As it currently functions this warning will display even if the user does 62 | " not have nerdtree-git-plugin not just if it isn't loaded yet 63 | " (not what we want) 64 | "if !exists('g:loaded_nerdtree_git_status') 65 | " echohl WarningMsg | 66 | " \ echomsg 'vim-webdevicons works better when 'nerdtree-git-plugin' is loaded before vim-webdevicons (small refresh issues otherwise).' 67 | "endif 68 | endif 69 | 70 | if !exists('g:webdevicons_enable_airline_tabline') 71 | let g:webdevicons_enable_airline_tabline = 1 72 | endif 73 | 74 | if !exists('g:webdevicons_enable_airline_statusline') 75 | let g:webdevicons_enable_airline_statusline = 1 76 | endif 77 | 78 | function! s:SetupListeners() 79 | call g:NERDTreePathNotifier.AddListener('init', 'NERDTreeWebDevIconsRefreshListener') 80 | call g:NERDTreePathNotifier.AddListener('refresh', 'NERDTreeWebDevIconsRefreshListener') 81 | call g:NERDTreePathNotifier.AddListener('refreshFlags', 'NERDTreeWebDevIconsRefreshListener') 82 | endfunction 83 | 84 | " util like helpers 85 | " scope: local 86 | function! s:Refresh() 87 | call b:NERDTree.root.refreshFlags() 88 | call NERDTreeRender() 89 | endfunction 90 | 91 | " Temporary (hopefully) fix for glyph issues in gvim (proper fix is with the 92 | " actual font patcher) 93 | 94 | " NERDTree-C 95 | " scope: global 96 | function! WebDevIconsNERDTreeChangeRootHandler(node) 97 | call b:NERDTree.changeRoot(a:node) 98 | call NERDTreeRender() 99 | call a:node.putCursorHere(0, 0) 100 | if g:DevIconsEnableNERDTreeRedraw ==# 1 101 | redraw! 102 | endif 103 | endfunction 104 | 105 | " NERDTree-u 106 | " scope: global 107 | function! WebDevIconsNERDTreeUpDirCurrentRootClosedHandler() 108 | call nerdtree#ui_glue#upDir(0) 109 | if g:DevIconsEnableNERDTreeRedraw ==# 1 110 | redraw! 111 | endif 112 | endfunction 113 | 114 | function! WebDevIconsNERDTreeDirUpdateFlags(node, glyph) 115 | let path = a:node.path 116 | let isOpen = a:node.isOpen 117 | let postPadding = g:WebDevIconsNerdTreeAfterGlyphPadding 118 | let prePadding = g:WebDevIconsNerdTreeBeforeGlyphPadding 119 | let hasGitFlags = (len(path.flagSet._flagsForScope('git')) > 0) 120 | let hasGitNerdTreePlugin = (exists('g:loaded_nerdtree_git_status') == 1) 121 | let collapsesToSameLine = (exists('g:NERDTreeCascadeSingleChildDir') == 1) 122 | let dirHasOnlyOneChildDir = 0 123 | 124 | if collapsesToSameLine 125 | " need to call to determin children: 126 | call a:node._initChildren(1) 127 | let dirHasOnlyOneChildDir = (a:node.getChildCount() ==# 1 && a:node.children[0].path.isDirectory) 128 | endif 129 | 130 | " properly set collapsed/combined directory display to opened glyph 131 | if collapsesToSameLine && dirHasOnlyOneChildDir 132 | call WebDevIconsNERDTreeDirOpen(a:node.children[0]) 133 | endif 134 | 135 | " align vertically at the same level: non git-flag nodes with git-flag nodes 136 | if g:WebDevIconsNerdTreeGitPluginForceVAlign && !hasGitFlags && hasGitNerdTreePlugin 137 | let prePadding .= ' ' 138 | endif 139 | 140 | let flag = prePadding . a:glyph . postPadding 141 | 142 | call a:node.path.flagSet.clearFlags('webdevicons') 143 | 144 | if flag !=? '' 145 | call a:node.path.flagSet.addFlag('webdevicons', flag) 146 | "echom "added flag of " . flag 147 | call a:node.path.refreshFlags(b:NERDTree) 148 | "echom "flagset is now " . string(a:node.path.flagSet) 149 | endif 150 | endfunction 151 | 152 | function! WebDevIconsNERDTreeDirClose(node) 153 | let a:node.path.isOpen = 0 154 | let glyph = g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol 155 | call WebDevIconsNERDTreeDirUpdateFlags(a:node, glyph) 156 | endfunction 157 | 158 | function! WebDevIconsNERDTreeDirOpen(node) 159 | let a:node.path.isOpen = 1 160 | let glyph = g:DevIconsDefaultFolderOpenSymbol 161 | call WebDevIconsNERDTreeDirUpdateFlags(a:node, glyph) 162 | endfunction 163 | 164 | function! WebDevIconsNERDTreeDirOpenRecursively(node) 165 | call WebDevIconsNERDTreeDirOpen(a:node) 166 | for i in a:node.children 167 | if i.path.isDirectory ==# 1 168 | call WebDevIconsNERDTreeDirOpenRecursively(i) 169 | endif 170 | endfor 171 | endfunction 172 | 173 | function! WebDevIconsNERDTreeDirCloseRecursively(node) 174 | call WebDevIconsNERDTreeDirClose(a:node) 175 | for i in a:node.children 176 | if i.path.isDirectory ==# 1 177 | call WebDevIconsNERDTreeDirCloseRecursively(i) 178 | endif 179 | endfor 180 | endfunction 181 | 182 | function! WebDevIconsNERDTreeDirCloseChildren(node) 183 | for i in a:node.children 184 | if i.path.isDirectory ==# 1 185 | call WebDevIconsNERDTreeDirClose(i) 186 | endif 187 | endfor 188 | endfunction 189 | 190 | " NERDTreeMapActivateNode and <2-LeftMouse> 191 | " handle the user activating a tree node 192 | " scope: global 193 | function! WebDevIconsNERDTreeMapActivateNode(node) 194 | let isOpen = a:node.isOpen 195 | if isOpen 196 | let glyph = g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol 197 | else 198 | let glyph = g:DevIconsDefaultFolderOpenSymbol 199 | endif 200 | let a:node.path.isOpen = !isOpen 201 | call WebDevIconsNERDTreeDirUpdateFlags(a:node, glyph) 202 | " continue with normal activate logic 203 | call a:node.activate() 204 | " glyph change possible artifact clean-up 205 | if g:DevIconsEnableNERDTreeRedraw ==# 1 206 | redraw! 207 | endif 208 | endfunction 209 | 210 | " NERDTreeMapActivateNodeSingleMode 211 | " handle the user activating a tree node if NERDTreeMouseMode is setted to 3 212 | " scope: global 213 | function! WebDevIconsNERDTreeMapActivateNodeSingleMode(node) 214 | if g:NERDTreeMouseMode == 3 215 | let isOpen = a:node.isOpen 216 | if isOpen 217 | let glyph = g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol 218 | else 219 | let glyph = g:DevIconsDefaultFolderOpenSymbol 220 | endif 221 | let a:node.path.isOpen = !isOpen 222 | call WebDevIconsNERDTreeDirUpdateFlags(a:node, glyph) 223 | " continue with normal activate logic 224 | call a:node.activate() 225 | " glyph change possible artifact clean-up 226 | if g:DevIconsEnableNERDTreeRedraw ==# 1 227 | redraw! 228 | endif 229 | endif 230 | endfunction 231 | 232 | function! WebDevIconsNERDTreeMapOpenRecursively(node) 233 | " normal original logic: 234 | call nerdtree#echo('Recursively opening node. Please wait...') 235 | call WebDevIconsNERDTreeDirOpenRecursively(a:node) 236 | call a:node.openRecursively() 237 | " continue with normal original logic: 238 | call b:NERDTree.render() 239 | " glyph change possible artifact clean-up 240 | if g:DevIconsEnableNERDTreeRedraw ==# 1 241 | redraw! 242 | endif 243 | call nerdtree#echo('Recursively opening node. Please wait... DONE') 244 | endfunction 245 | 246 | function! WebDevIconsNERDTreeMapCloseChildren(node) 247 | " close children but not current node: 248 | call WebDevIconsNERDTreeDirCloseChildren(a:node) 249 | " continue with normal original logic: 250 | call a:node.closeChildren() 251 | call b:NERDTree.render() 252 | call a:node.putCursorHere(0, 0) 253 | " glyph change possible artifact clean-up 254 | if g:DevIconsEnableNERDTreeRedraw ==# 1 255 | redraw! 256 | endif 257 | endfunction 258 | 259 | function! WebDevIconsNERDTreeMapCloseDir(node) 260 | " continue with normal original logic: 261 | let parent = a:node.parent 262 | while g:NERDTreeCascadeOpenSingleChildDir && !parent.isRoot() 263 | let childNodes = parent.getVisibleChildren() 264 | if len(childNodes) == 1 && childNodes[0].path.isDirectory 265 | let parent = parent.parent 266 | else 267 | break 268 | endif 269 | endwhile 270 | if parent ==# {} || parent.isRoot() 271 | call nerdtree#echo('cannot close tree root') 272 | else 273 | call parent.close() 274 | " update the glyph 275 | call WebDevIconsNERDTreeDirClose(parent) 276 | call b:NERDTree.render() 277 | call parent.putCursorHere(0, 0) 278 | " glyph change possible artifact clean-up 279 | if g:DevIconsEnableNERDTreeRedraw ==# 1 280 | redraw! 281 | endif 282 | endif 283 | endfunction 284 | 285 | function! WebDevIconsNERDTreeMapUpdirKeepOpen() 286 | call WebDevIconsNERDTreeDirOpen(b:NERDTree.root) 287 | " continue with normal logic: 288 | call nerdtree#ui_glue#upDir(1) 289 | call s:Refresh() 290 | " glyph change possible artifact clean-up 291 | if g:DevIconsEnableNERDTreeRedraw ==# 1 292 | redraw! 293 | endif 294 | endfunction 295 | 296 | if g:webdevicons_enable == 1 && g:webdevicons_enable_nerdtree == 1 297 | call s:SetupListeners() 298 | 299 | if g:DevIconsEnableFoldersOpenClose 300 | 301 | " These overrides are needed because we cannot 302 | " simply use AddListener for reliably updating 303 | " the folder open/close glyphs because the event 304 | " path has no access to the 'isOpen' property 305 | " some of these are a little more brittle/fragile 306 | " than others 307 | " TODO FIXME better way to reliably update 308 | " open/close glyphs in NERDTreeWebDevIconsRefreshListener 309 | 310 | " NERDTreeMapActivateNode 311 | call NERDTreeAddKeyMap({ 312 | \ 'key': g:NERDTreeMapActivateNode, 313 | \ 'callback': 'WebDevIconsNERDTreeMapActivateNode', 314 | \ 'override': 1, 315 | \ 'scope': 'DirNode' }) 316 | 317 | " NERDTreeMapCustomOpen 318 | call NERDTreeAddKeyMap({ 319 | \ 'key': g:NERDTreeMapCustomOpen, 320 | \ 'callback': 'WebDevIconsNERDTreeMapActivateNode', 321 | \ 'override': 1, 322 | \ 'scope': 'DirNode' }) 323 | 324 | " NERDTreeMapOpenRecursively 325 | call NERDTreeAddKeyMap({ 326 | \ 'key': g:NERDTreeMapOpenRecursively, 327 | \ 'callback': 'WebDevIconsNERDTreeMapOpenRecursively', 328 | \ 'override': 1, 329 | \ 'scope': 'DirNode' }) 330 | 331 | " NERDTreeMapCloseChildren 332 | call NERDTreeAddKeyMap({ 333 | \ 'key': g:NERDTreeMapCloseChildren, 334 | \ 'callback': 'WebDevIconsNERDTreeMapCloseChildren', 335 | \ 'override': 1, 336 | \ 'scope': 'DirNode' }) 337 | 338 | " NERDTreeMapCloseChildren 339 | call NERDTreeAddKeyMap({ 340 | \ 'key': g:NERDTreeMapCloseDir, 341 | \ 'callback': 'WebDevIconsNERDTreeMapCloseDir', 342 | \ 'override': 1, 343 | \ 'scope': 'Node' }) 344 | 345 | " <2-LeftMouse> 346 | call NERDTreeAddKeyMap({ 347 | \ 'key': '<2-LeftMouse>', 348 | \ 'callback': 'WebDevIconsNERDTreeMapActivateNode', 349 | \ 'override': 1, 350 | \ 'scope': 'DirNode' }) 351 | 352 | " 353 | call NERDTreeAddKeyMap({ 354 | \ 'key': '', 355 | \ 'callback': 'WebDevIconsNERDTreeMapActivateNodeSingleMode', 356 | \ 'override': 1, 357 | \ 'scope': 'DirNode' }) 358 | 359 | " NERDTreeMapUpdirKeepOpen 360 | call NERDTreeAddKeyMap({ 361 | \ 'key': g:NERDTreeMapUpdirKeepOpen, 362 | \ 'callback': 'WebDevIconsNERDTreeMapUpdirKeepOpen', 363 | \ 'override': 1, 364 | \ 'scope': 'all' }) 365 | 366 | endif 367 | 368 | " Temporary (hopefully) fix for glyph issues in gvim (proper fix is with the 369 | " actual font patcher) 370 | if g:webdevicons_gui_glyph_fix ==# 1 371 | call NERDTreeAddKeyMap({ 372 | \ 'key': g:NERDTreeMapChangeRoot, 373 | \ 'callback': 'WebDevIconsNERDTreeChangeRootHandler', 374 | \ 'override': 1, 375 | \ 'quickhelpText': "change tree root to the\n\" selected dir\n\" plus devicons redraw\n\" hack fix", 376 | \ 'scope': 'Node' }) 377 | 378 | call NERDTreeAddKeyMap({ 379 | \ 'key': g:NERDTreeMapUpdir, 380 | \ 'callback': 'WebDevIconsNERDTreeUpDirCurrentRootClosedHandler', 381 | \ 'override': 1, 382 | \ 'quickhelpText': "move tree root up a dir\n\" plus devicons redraw\n\" hack fix", 383 | \ 'scope': 'all' }) 384 | endif 385 | 386 | endif 387 | 388 | " modeline syntax: 389 | " vim: fdm=marker tabstop=2 softtabstop=2 shiftwidth=2 expandtab: 390 | -------------------------------------------------------------------------------- /plugin/webdevicons.vim: -------------------------------------------------------------------------------- 1 | " Version: 0.11.0 2 | " Webpage: https://github.com/ryanoasis/vim-devicons 3 | " Maintainer: Ryan McIntyre 4 | " License: see LICENSE 5 | 6 | let s:version = '0.11.0' 7 | let s:plugin_home = expand(':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: 704 | -------------------------------------------------------------------------------- /pythonx/vim_devicons/__init__.py: -------------------------------------------------------------------------------- 1 | import pkg_resources 2 | pkg_resources.declare_namespace(__name__) 3 | -------------------------------------------------------------------------------- /pythonx/vim_devicons/powerline/__init__.py: -------------------------------------------------------------------------------- 1 | import pkg_resources 2 | pkg_resources.declare_namespace(__name__) 3 | -------------------------------------------------------------------------------- /pythonx/vim_devicons/powerline/segments.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim:se fenc=utf8 noet: 3 | from __future__ import (unicode_literals, division, absolute_import, print_function) 4 | 5 | try: 6 | import vim 7 | except ImportError: 8 | vim = {} 9 | 10 | from powerline.bindings.vim import (vim_get_func, buffer_name) 11 | from powerline.theme import requires_segment_info 12 | 13 | @requires_segment_info 14 | def webdevicons(pl, segment_info): 15 | webdevicons = vim_get_func('WebDevIconsGetFileTypeSymbol') 16 | name = buffer_name(segment_info) 17 | return [] if not webdevicons else [{ 18 | 'contents': webdevicons(name), 19 | 'highlight_groups': ['webdevicons', 'file_name'], 20 | }] 21 | 22 | @requires_segment_info 23 | def webdevicons_file_format(pl, segment_info): 24 | webdevicons_file_format = vim_get_func('WebDevIconsGetFileFormatSymbol') 25 | return [] if not webdevicons_file_format else [{ 26 | 'contents': webdevicons_file_format(), 27 | 'highlight_groups': ['webdevicons_file_format', 'file_format'], 28 | }] 29 | -------------------------------------------------------------------------------- /rplugin/python3/denite/filter/devicons_denite_converter.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # vim:se fenc=utf8 noet: 3 | from .base import Base 4 | from os.path import isdir 5 | 6 | 7 | class Filter(Base): 8 | 9 | def __init__(self, vim): 10 | super().__init__(vim) 11 | self.name = 'devicons_denite_converter' 12 | self.description = 'add devicons in front of candidates' 13 | 14 | def filter(self, context): 15 | for candidate in context['candidates']: 16 | 17 | if 'bufnr' in candidate: 18 | bufname = self.vim.funcs.bufname(candidate['bufnr']) 19 | filename = self.vim.funcs.fnamemodify(bufname, ':p:t') 20 | elif 'word' in candidate and 'action__path' in candidate: 21 | filename = candidate['word'] 22 | 23 | icon = self.vim.funcs.WebDevIconsGetFileTypeSymbol( 24 | filename, isdir(filename)) 25 | 26 | # Customize output format if not done already. 27 | if icon not in candidate.get('abbr', '')[:10]: 28 | candidate['abbr'] = ' {} {}'.format( 29 | icon, candidate.get('abbr', candidate['word'])) 30 | 31 | return context['candidates'] 32 | -------------------------------------------------------------------------------- /test/.themisrc: -------------------------------------------------------------------------------- 1 | filetype plugin on 2 | -------------------------------------------------------------------------------- /test/default_setting.vim: -------------------------------------------------------------------------------- 1 | scriptencoding utf-8 2 | 3 | let s:suite = themis#suite('Webdevicons-default-value') 4 | let s:assert = themis#helper('assert') 5 | 6 | function! s:suite.ExtensionConfig() 7 | call s:assert.equals(g:webdevicons_enable, 1) 8 | call s:assert.equals(g:webdevicons_enable_nerdtree, 1) 9 | call s:assert.equals(g:webdevicons_enable_unite, 1) 10 | call s:assert.equals(g:webdevicons_enable_denite, 1) 11 | call s:assert.equals(g:webdevicons_enable_vimfiler, 1) 12 | call s:assert.equals(g:webdevicons_enable_ctrlp, 1) 13 | call s:assert.equals(g:webdevicons_enable_airline_tabline, 1) 14 | call s:assert.equals(g:webdevicons_enable_airline_statusline, 1) 15 | call s:assert.equals(g:webdevicons_enable_airline_statusline_fileformat_symbols, 1) 16 | call s:assert.equals(g:webdevicons_enable_flagship_statusline, 1) 17 | call s:assert.equals(g:webdevicons_enable_flagship_statusline_fileformat_symbols, 1) 18 | call s:assert.equals(g:webdevicons_enable_startify, 1) 19 | call s:assert.equals(g:webdevicons_conceal_nerdtree_brackets, 1) 20 | endfunction 21 | 22 | function! s:suite.ConfigOptions() 23 | call s:assert.equals(g:DevIconsAppendArtifactFix, 0) 24 | call s:assert.equals(g:DevIconsArtifactFixChar, ' ') 25 | call s:assert.equals(g:WebDevIconsUnicodeDecorateFileNodes, 1) 26 | call s:assert.equals(g:WebDevIconsUnicodeDecorateFolderNodes, 1) 27 | call s:assert.equals(g:DevIconsEnableFoldersOpenClose, 0) 28 | call s:assert.equals(g:DevIconsEnableFolderPatternMatching, 1) 29 | call s:assert.equals(g:DevIconsEnableFolderExtensionPatternMatching, 0) 30 | call s:assert.equals(1, g:WebDevIconsUnicodeDecorateFolderNodesExactMatches, 1) 31 | call s:assert.equals(1, g:WebDevIconsUnicodeGlyphDoubleWidth, 1) 32 | call s:assert.equals(g:WebDevIconsNerdTreeBeforeGlyphPadding, ' ') 33 | call s:assert.equals(g:WebDevIconsNerdTreeAfterGlyphPadding, ' ') 34 | call s:assert.equals(g:WebDevIconsNerdTreeGitPluginForceVAlign, 1) 35 | call s:assert.equals(g:NERDTreeUpdateOnCursorHold, 1) " Obsolete: for backward compatibility 36 | call s:assert.equals(g:NERDTreeGitStatusUpdateOnCursorHold, 1) 37 | call s:assert.equals(g:WebDevIconsTabAirLineBeforeGlyphPadding, ' ') 38 | call s:assert.equals(g:WebDevIconsTabAirLineAfterGlyphPadding, '') 39 | endfunction 40 | -------------------------------------------------------------------------------- /test/fileformat.vim: -------------------------------------------------------------------------------- 1 | scriptencoding utf-8 2 | 3 | " Please use nerd-font if you watch icon-font 4 | 5 | let s:suite = themis#suite('WebDevIconsGetFileFormatSymbol') 6 | let s:assert = themis#helper('assert') 7 | 8 | function! s:suite.UnixIcon() 9 | set fileformat=unix 10 | let os = system('uname -a') 11 | if os =~# 'Darwin' 12 | call s:assert.equals(WebDevIconsGetFileFormatSymbol(), '') 13 | " It may return Ubuntu because github-actions's OS is Ubuntu 14 | elseif os =~# 'Ubuntu' 15 | call s:assert.equals(WebDevIconsGetFileFormatSymbol(), '') 16 | else 17 | call s:assert.skip('Skip testing except for Ubuntu and Mac.') 18 | endif 19 | endfunction 20 | 21 | function! s:suite.WindowsIcon() 22 | set fileformat=dos 23 | call s:assert.equals(WebDevIconsGetFileFormatSymbol(), '') 24 | endfunction 25 | 26 | function! s:suite.MacIcon() 27 | set fileformat=mac 28 | call s:assert.equals(WebDevIconsGetFileFormatSymbol(), '') 29 | endfunction 30 | -------------------------------------------------------------------------------- /test/filetype.vim: -------------------------------------------------------------------------------- 1 | scriptencoding utf-8 2 | 3 | " Please use nerd-font if you watch icon-font 4 | 5 | let s:suite = themis#suite('WebDevIconsGetFileTypeSymbol') 6 | let s:assert = themis#helper('assert') 7 | 8 | function! s:Assert(filename, icon) 9 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(a:filename), a:icon) 10 | endfunction 11 | 12 | function! s:suite.NoArgument_GetDefaultIcon() 13 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') 14 | endfunction 15 | 16 | function! s:suite.__OneArgument_VimIcon__() 17 | let targetfilenames = ['.vimrc', 'vimrc', '.gvimrc', '_gvimrc', 'test.vim'] 18 | let expecticon = '' 19 | let child = themis#suite('OneArgument_VimIcon') 20 | 21 | for targetfilename in targetfilenames 22 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 23 | endfor 24 | endfunction 25 | 26 | function! s:suite.__OneArgument_RubyIcon__() 27 | let targetfilenames = ['test.rb', 'rakefile', 'RAKEFILE', 'Gemfile', 'config.ru'] 28 | let expecticon = '' 29 | let child = themis#suite('OneArgument_RubyIcon') 30 | 31 | for targetfilename in targetfilenames 32 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 33 | endfor 34 | endfunction 35 | 36 | function! s:suite.__OneArgument_MarkDownIcon__() 37 | let targetfilenames = ['test.md', 'test.markdown', 'test.mdx', 'test.rmd'] 38 | let expecticon = '' 39 | let child = themis#suite('OneArgument_MarkDownIcon') 40 | 41 | for targetfilename in targetfilenames 42 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 43 | endfor 44 | endfunction 45 | 46 | function! s:suite.__OneArgument_PythonIcon__() 47 | let targetfilenames = ['test.py', 'test.pyc', 'test.pyo', 'test.pyd'] 48 | let expecticon = '' 49 | let child = themis#suite('OneArgument_PythonIcon') 50 | 51 | for targetfilename in targetfilenames 52 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 53 | endfor 54 | endfunction 55 | 56 | function! s:suite.__OneArgument_ShellIcon__() 57 | let targetfilenames = ['test.sh', 'test.fish', 'test.bash', 'test.ksh', 'test.csh', 'test.awk', 'test.ps1'] 58 | let expecticon = '' 59 | let child = themis#suite('OneArgument_ShellIcon') 60 | 61 | for targetfilename in targetfilenames 62 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 63 | endfor 64 | endfunction 65 | 66 | function! s:suite.__OneArgument_DBIcon__() 67 | let targetfilenames = ['test.db', 'test.sql', 'test.dump'] 68 | let expecticon = '' 69 | let child = themis#suite('OneArgument_DBIcon') 70 | 71 | for targetfilename in targetfilenames 72 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 73 | endfor 74 | endfunction 75 | 76 | function! s:suite.__OneArgument_RustIcon__() 77 | let targetfilenames = ['test.rs', 'test.rlib'] 78 | let expecticon = '' 79 | let child = themis#suite('OneArgument_RustIcon') 80 | 81 | for targetfilename in targetfilenames 82 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 83 | endfor 84 | endfunction 85 | 86 | function! s:suite.__OneArgument_DockerIcon__() 87 | let targetfilenames = ['Dockerfile', 'docker-compose.yml'] 88 | let expecticon = '' 89 | let child = themis#suite('OneArgument_DockerIcon') 90 | 91 | for targetfilename in targetfilenames 92 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 93 | endfor 94 | endfunction 95 | 96 | function! s:suite.__OneArgument_JavaScriptIcon__() 97 | let targetfilenames = ['test.js', 'test.mjs'] 98 | let expecticon = '' 99 | let child = themis#suite('OneArgument_JavaScriptIcon') 100 | 101 | for targetfilename in targetfilenames 102 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 103 | endfor 104 | endfunction 105 | 106 | function! s:suite.__OneArgument_ReactIcon__() 107 | let targetfilenames = ['test.jsx', 'test.tsx', 'react.jsx'] 108 | let expecticon = '' 109 | let child = themis#suite('OneArgument_ReactIcon') 110 | 111 | for targetfilename in targetfilenames 112 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 113 | endfor 114 | endfunction 115 | 116 | function! s:suite.__OneArgument_JsonIcon__() 117 | let targetfilenames = ['test.json', 'test.webmanifest'] 118 | let expecticon = '' 119 | let child = themis#suite('OneArgument_JsonIcon') 120 | 121 | for targetfilename in targetfilenames 122 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 123 | endfor 124 | endfunction 125 | 126 | function! s:suite.__OneArgument_GearIcon__() 127 | let targetfilenames = ['.DS_Store', 'Makefile', 'test.mk', '.bashrc', '.zshrc', '.gitignore', '.gitattributes', 'cmakelists.txt', 'test.yaml', 'test.yml', 'test.toml', 'test.bat'] 128 | let expecticon = '' 129 | let child = themis#suite('OneArgument_GearIcon') 130 | 131 | for targetfilename in targetfilenames 132 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 133 | endfor 134 | endfunction 135 | 136 | function! s:suite.__OneArgument_ErlangIcon__() 137 | let targetfilenames = ['test.erl', 'test.hrl'] 138 | let expecticon = '' 139 | let child = themis#suite('OneArgument_ErlangIcon') 140 | 141 | for targetfilename in targetfilenames 142 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 143 | endfor 144 | endfunction 145 | 146 | function! s:suite.__OneArgument_SwiftIcon__() 147 | let targetfilenames = ['test.swift', 'test.xcplayground'] 148 | let expecticon = '' 149 | let child = themis#suite('OneArgument_SwiftIcon') 150 | 151 | for targetfilename in targetfilenames 152 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 153 | endfor 154 | endfunction 155 | 156 | function! s:suite.__OneArgument_HaskellIcon__() 157 | let targetfilenames = ['test.hs', 'test.lhs'] 158 | let expecticon = '' 159 | let child = themis#suite('OneArgument_HaskellIcon') 160 | 161 | for targetfilename in targetfilenames 162 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 163 | endfor 164 | endfunction 165 | 166 | function! s:suite.__OneArgument_CppIcon__() 167 | let targetfilenames = ['test.cpp', 'test.c++', 'test.cp', 'test.cxx', 'test.cc'] 168 | let expecticon = '' 169 | let child = themis#suite('OneArgument_C++Icon') 170 | 171 | for targetfilename in targetfilenames 172 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 173 | endfor 174 | endfunction 175 | 176 | function! s:suite.__OneArgument_ElixirIcon__() 177 | let targetfilenames = ['test.ex', 'test.exs', 'test.eex', 'test.leex', 'test.heex'] 178 | let expecticon = '' 179 | let child = themis#suite('OneArgument_ElixirIcon') 180 | 181 | for targetfilename in targetfilenames 182 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 183 | endfor 184 | endfunction 185 | 186 | function! s:suite.__OneArgument_PerlIcon__() 187 | let targetfilenames = ['test.pl', 'test.pm', 'test.t'] 188 | let expecticon = '' 189 | let child = themis#suite('OneArgument_PerlIcon') 190 | 191 | for targetfilename in targetfilenames 192 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 193 | endfor 194 | endfunction 195 | 196 | function! s:suite.__OneArgument_FSharpIcon__() 197 | let targetfilenames = ['test.fs', 'test.fsx', 'test.fsi', 'test.fsscript'] 198 | let expecticon = '' 199 | let child = themis#suite('OneArgument_FSharpIcon') 200 | 201 | for targetfilename in targetfilenames 202 | let child[targetfilename] = funcref('s:Assert', [targetfilename, expecticon]) 203 | endfor 204 | endfunction 205 | 206 | function! s:suite.OneArgument_GetTypeScriptIcon() 207 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.ts'), '') 208 | endfunction 209 | 210 | function! s:suite.OneArgument_GetVueIcon() 211 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.vue'), '﵂') 212 | endfunction 213 | 214 | function! s:suite.OneArgument_GetNodeModuleIcon() 215 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('node_modules'), '') 216 | endfunction 217 | 218 | function! s:suite.OneArgument_GetDropboxIcon() 219 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('Dropbox'), '') 220 | endfunction 221 | 222 | function! s:suite.OneArgument_GetRIcon() 223 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.r'), 'ﳒ') 224 | endfunction 225 | 226 | function! s:suite.OneArgument_GetLuaIcon() 227 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.lua'), '') 228 | endfunction 229 | 230 | function! s:suite.OneArgument_GetJavaIcon() 231 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.java'), '') 232 | endfunction 233 | 234 | function! s:suite.OneArgument_GetCIcon() 235 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.c'), '') 236 | endfunction 237 | 238 | function! s:suite.OneArgument_GetCSSIcon() 239 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.cs'), '') 240 | endfunction 241 | 242 | function! s:suite.OneArgument_GetCSharpIcon() 243 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.cs'), '') 244 | endfunction 245 | 246 | function! s:suite.OneArgument_GetElmIcon() 247 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.elm'), '') 248 | endfunction 249 | 250 | function! s:suite.OneArgument_GetRssIcon() 251 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.rss'), '') 252 | endfunction 253 | 254 | function! s:suite.OneArgument_GetDartIcon() 255 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.dart'), '') 256 | endfunction 257 | 258 | function! s:suite.OneArgument_GetSolidityIcon() 259 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.sol'), 'ﲹ') 260 | endfunction 261 | 262 | function! s:suite.OneArgument_GetGoIcon() 263 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.go'), '') 264 | endfunction 265 | 266 | function! s:suite.OneArgument_GetPhpIcon() 267 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.php'),'') 268 | endfunction 269 | 270 | function! s:suite.OneArgument_GetScalaIcon() 271 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('test.scala'), '') 272 | endfunction 273 | 274 | function! s:suite.OneArgument_GetTexIcon() 275 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('test.tex'), 'ﭨ') 276 | endfunction 277 | 278 | function! s:suite.OneArgument_GetLicenseIcon() 279 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('LICENSE'), '') 280 | endfunction 281 | 282 | function! s:suite.OneArgument_GetRobotIcon() 283 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('robots.txt'), 'ﮧ') 284 | endfunction 285 | 286 | function! s:suite.OneArgument_PemIcon() 287 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('test.pem'), '') 288 | endfunction 289 | 290 | function! s:suite.TwoArgument_zero_GetFileIcon() 291 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('test.vim', 0), '') 292 | endfunction 293 | 294 | function! s:suite.TwoArgument_one_GetFolderIcon() 295 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('test.vim', 1), '') 296 | endfunction 297 | 298 | function! s:suite.TwoArgument_two_GetDefaultIcon() 299 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('test.vim', 2), '') 300 | endfunction 301 | 302 | function! s:suite.TwoArgument_string_GetFileTypeIcon() 303 | call s:assert.equals( WebDevIconsGetFileTypeSymbol('test.php', 'test.vim'), '') 304 | endfunction 305 | 306 | function! s:suite.NoArgument_OverWriteFileType_GetVimIcon() 307 | set ft=vim 308 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') 309 | endfunction 310 | 311 | function! s:suite.NoArgument_EditVimFile_GetVimIcon() 312 | edit! test.vim 313 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') 314 | endfunction 315 | 316 | function! s:suite.NoArgument_Editvimrc_GetVimIcon() 317 | edit! vimrc 318 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') 319 | endfunction 320 | 321 | function! s:suite.NoArgument_EditPythonFile_GetPythonIcon() 322 | edit! test.py 323 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') 324 | endfunction 325 | 326 | function! s:suite.NoArgument_EditjavaScriptFile_GetjavaScriptIcon() 327 | edit! test.js 328 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') 329 | endfunction 330 | 331 | function! s:suite.NoArgument_EditRustFile_GetRustIcon() 332 | edit! test.rs 333 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') 334 | endfunction 335 | 336 | function! s:suite.NoArgument_EditMKFile_GetGearIcon() 337 | edit! test.mk 338 | call s:assert.equals(WebDevIconsGetFileTypeSymbol(), '') 339 | endfunction 340 | 341 | function! s:suite.OneArgument_EditPythonFile_GetRubyIcon() 342 | edit! test.py 343 | call s:assert.equals(WebDevIconsGetFileTypeSymbol('test.rb'), '') 344 | endfunction 345 | --------------------------------------------------------------------------------