legacy-dots

devicons.py

7.1 kB
  1#!/usr/bin/python
  2# coding=UTF-8
  3# These glyphs, and the mapping of file extensions to glyphs
  4# has been copied from the vimscript code that is present in
  5# https://github.com/ryanoasis/vim-devicons
  6import re;
  7import os;
  8
  9# all those glyphs will show as weird squares if you don't have the correct patched font
 10# My advice is to use NerdFonts which can be found here:
 11# https://github.com/ryanoasis/nerd-fonts
 12file_node_extensions = {
 13    '7z'       : '',
 14    'ai'       : '',
 15    'apk'      : '',
 16    'avi'      : '',
 17    'bat'      : '',
 18    'bmp'      : '',
 19    'bz2'      : '',
 20    'c'        : '',
 21    'c++'      : '',
 22    'cab'      : '',
 23    'cc'       : '',
 24    'clj'      : '',
 25    'cljc'     : '',
 26    'cljs'     : '',
 27    'coffee'   : '',
 28    'conf'     : '',
 29    'cp'       : '',
 30    'cpio'     : '',
 31    'cpp'      : '',
 32    'css'      : '',
 33    'cxx'      : '',
 34    'd'        : '',
 35    'dart'     : '',
 36    'db'       : '',
 37    'deb'      : '',
 38    'diff'     : '',
 39    'dump'     : '',
 40    'edn'      : '',
 41    'ejs'      : '',
 42    'epub'     : '',
 43    'erl'      : '',
 44    'f#'       : '',
 45    'fish'     : '',
 46    'flac'     : '',
 47    'flv'      : '',
 48    'fs'       : '',
 49    'fsi'      : '',
 50    'fsscript' : '',
 51    'fsx'      : '',
 52    'gem'      : '',
 53    'gif'      : '',
 54    'go'       : '',
 55    'gz'       : '',
 56    'gzip'     : '',
 57    'hbs'      : '',
 58    'hrl'      : '',
 59    'hs'       : '',
 60    'htm'      : '',
 61    'html'     : '',
 62    'ico'      : '',
 63    'ini'      : '',
 64    'java'     : '',
 65    'jl'       : '',
 66    'jpeg'     : '',
 67    'jpg'      : '',
 68    'js'       : '',
 69    'json'     : '',
 70    'jsx'      : '',
 71    'less'     : '',
 72    'lha'      : '',
 73    'lhs'      : '',
 74    'log'      : '',
 75    'lua'      : '',
 76    'lzh'      : '',
 77    'lzma'     : '',
 78    'markdown' : '',
 79    'md'       : '',
 80    'mkv'      : '',
 81    'ml'       : 'λ',
 82    'mli'      : 'λ',
 83    'mov'      : '',
 84    'mp3'      : '',
 85    'mp4'      : '',
 86    'mpeg'     : '',
 87    'mpg'      : '',
 88    'mustache' : '',
 89    'ogg'      : '',
 90    'pdf'      : '',
 91    'php'      : '',
 92    'pl'       : '',
 93    'pm'       : '',
 94    'png'      : '',
 95    'psb'      : '',
 96    'psd'      : '',
 97    'py'       : '',
 98    'pyc'      : '',
 99    'pyd'      : '',
100    'pyo'      : '',
101    'rar'      : '',
102    'rb'       : '',
103    'rc'       : '',
104    'rlib'     : '',
105    'rpm'      : '',
106    'rs'       : '',
107    'rss'      : '',
108    'scala'    : '',
109    'scss'     : '',
110    'sh'       : '',
111    'slim'     : '',
112    'sln'      : '',
113    'sql'      : '',
114    'styl'     : '',
115    'suo'      : '',
116    't'        : '',
117    'tar'      : '',
118    'tgz'      : '',
119    'ts'       : '',
120    'twig'     : '',
121    'vim'      : '',
122    'vimrc'    : '',
123    'wav'      : '',
124    'xml'      : '',
125    'xul'      : '',
126    'xz'       : '',
127    'yml'      : '',
128    'zip'      : '',
129}
130
131dir_node_exact_matches = {
132# English
133    '.git'                             : '',
134    'Desktop'                          : '',
135    'Documents'                        : '',
136    'Downloads'                        : '',
137    'Dropbox'                          : '',
138    'Music'                            : '',
139    'Pictures'                         : '',
140    'Public'                           : '',
141    'Templates'                        : '',
142    'Videos'                           : '',
143# French
144    'Bureau'                           : '',
145    'Documents'                        : '',
146    'Images'                           : '',
147    'Musique'                          : '',
148    'Publique'                         : '',
149    'Téléchargements'                  : '',
150    'Vidéos'                           : '',
151# Portuguese
152    'Documentos'                       : '',
153    'Imagens'                          : '',
154    'Modelos'                          : '',
155    'Música'                           : '',
156    'Público'                          : '',
157    'Vídeos'                           : '',
158    'Área de trabalho'                 : '',
159# Italian
160    'Documenti'                        : '',
161    'Immagini'                         : '',
162    'Modelli'                          : '',
163    'Musica'                           : '',
164    'Pubblici'                         : '',
165    'Scaricati'                        : '',
166    'Scrivania'                        : '',
167    'Video'                            : '',
168# German
169    'Bilder'                           : '',
170    'Dokumente'                        : '',
171    'Musik'                            : '',
172    'Schreibtisch'                     : '',
173    'Vorlagen'                         : '',
174    'Öffentlich'                       : '',
175}
176
177file_node_exact_matches = {
178    '.Xdefaults'                       : '',
179    '.Xresources'                      : '',
180    '.bashprofile'                     : '',
181    '.bashrc'                          : '',
182    '.dmrc'                            : '',
183    '.ds_store'                        : '',
184    '.fasd'                            : '',
185    '.gitconfig'                       : '',
186    '.gitignore'                       : '',
187    '.jack-settings'                   : '',
188    '.mime.types'                      : '',
189    '.nvidia-settings-rc'              : '',
190    '.pam_environment'                 : '',
191    '.profile'                         : '',
192    '.recently-used'                   : '',
193    '.selected_editor'                 : '',
194    '.vimrc'                           : '',
195    '.xinputrc'                        : '',
196    'config'                           : '',
197    'dropbox'                          : '',
198    'exact-match-case-sensitive-1.txt' : 'X1',
199    'exact-match-case-sensitive-2'     : 'X2',
200    'favicon.ico'                      : '',
201    'gruntfile.coffee'                 : '',
202    'gruntfile.js'                     : '',
203    'gruntfile.ls'                     : '',
204    'gulpfile.coffee'                  : '',
205    'gulpfile.js'                      : '',
206    'gulpfile.ls'                      : '',
207    'ini'                              : '',
208    'ledger'                           : '',
209    'license'                          : '',
210    'mimeapps.list'                    : '',
211    'node_modules'                     : '',
212    'procfile'                         : '',
213    'react.jsx'                        : '',
214    'user-dirs.dirs'                   : '',
215}
216
217def devicon(file):
218  if file.is_directory: return dir_node_exact_matches.get(file.relative_path, '')
219  return file_node_exact_matches.get(file.relative_path, file_node_extensions.get(file.extension, ''))