dgy
/
hexagons
Archived
1
0
Fork 0
This repository has been archived on 2021-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
hexagons/.config/ranger/devicons.py

240 lines
4.9 KiB
Python

#!/usr/bin/python
# coding=UTF-8
# These glyphs, and the mapping of file extensions to glyphs
# has been copied from the vimscript code that is present in
# https://github.com/ryanoasis/vim-devicons
import os
import re
# all those glyphs will show as weird squares
# if you don't have the correct patched font
# My advice is to use NerdFonts which can be found here:
# https://github.com/ryanoasis/nerd-fonts
file_node_extensions = {
'7z': '',
'ai': '',
'apk': '',
'avi': '',
'bat': '',
'bmp': '',
'bz2': '',
'c': '',
'c++': '',
'cab': '',
'cbr': '',
'cbz': '',
'cc': '',
'clj': '',
'cljc': '',
'cljs': '',
'coffee': '',
'conf': '',
'cp': '',
'cpio': '',
'cpp': '',
'css': '',
'cxx': '',
'd': '',
'dart': '',
'db': '',
'deb': '',
'diff': '',
'dump': '',
'edn': '',
'ejs': '',
'epub': '',
'erl': '',
'exe': '',
'f#': '',
'fish': '',
'flac': '',
'flv': '',
'fs': '',
'fsi': '',
'fsscript': '',
'fsx': '',
'gem': '',
'gif': '',
'go': '',
'gz': '',
'gzip': '',
'hbs': '',
'hrl': '',
'hs': '',
'htm': '',
'html': '',
'ico': '',
'ini': '',
'java': '',
'jl': '',
'jpeg': '',
'jpg': '',
'js': '',
'json': '',
'jsx': '',
'less': '',
'lha': '',
'lhs': '',
'log': '',
'lua': '',
'lzh': '',
'lzma': '',
'm4a': '',
'markdown': '',
'md': '',
'mkv': '',
'ml': 'λ',
'mli': 'λ',
'mov': '',
'mp3': '',
'mp4': '',
'mpeg': '',
'mpg': '',
'mustache': '',
'ogg': '',
'pdf': '',
'php': '',
'pl': '',
'pm': '',
'png': '',
'psb': '',
'psd': '',
'py': '',
'pyc': '',
'pyd': '',
'pyo': '',
'rar': '',
'rb': '',
'rc': '',
'rlib': '',
'rpm': '',
'rs': '',
'rss': '',
'scala': '',
'scss': '',
'sh': '',
'slim': '',
'sln': '',
'sql': '',
'styl': '',
'suo': '',
't': '',
'tar': '',
'tgz': '',
'ts': '',
'twig': '',
'vim': '',
'vimrc': '',
'wav': '',
'webm': '',
'xml': '',
'xul': '',
'xz': '',
'yml': '',
'zip': '',
'zsh': '',
'xcf': '',
'tex': '',
'txt': '',
'lock': '',
'h': '',
'o': '',
'blend': '',
'1': '',
'jar': '',
'desktop': '',
'mk': '',
'torrent': '',
'added': '',
'pem': '',
'svg': '',
'scd': '',
'theme': '',
'iso': '',
'mid': '',
'url': '',
'part': '',
'nfo': '',
'pd': '',
'ttf': '',
'otf': '',
'bdf': '',
'pcf': '',
}
dir_node_exact_matches = {
# English
'.git': '',
'Desktop': '',
'Documents': '',
'Downloads': '',
'Music': '',
'Pictures': '',
'Public': '',
'Templates': '',
'Videos': '',
'mail': '',
'.mail': '',
'.cache': '',
'.config': '',
'trash': '',
'Trash': '',
'bin': '',
'hexagons': '',
}
file_node_exact_matches = {
'.Xdefaults': '',
'.Xresources': '',
'.bashprofile': '',
'.zprofile': '',
'.bashrc': '',
'.zshrc': '',
'.zshenv': '',
'.dmrc': '',
'.ds_store': '',
'.fasd': '',
'.gitconfig': '',
'.gitignore': '',
'.jack-settings': '',
'.mime.types': '',
'.nvidia-settings-rc': '',
'.pam_environment': '',
'.profile': '',
'.recently-used': '',
'.selected_editor': '',
'.vimrc': '',
'.xinputrc': '',
'.xserverrc': '',
'config': '',
'dropbox': '',
'exact-match-case-sensitive-1.txt': 'X1',
'exact-match-case-sensitive-2': 'X2',
'favicon.ico': '',
'gruntfile.coffee': '',
'gruntfile.js': '',
'gruntfile.ls': '',
'gulpfile.coffee': '',
'gulpfile.js': '',
'gulpfile.ls': '',
'ini': '',
'ledger': '',
'license': '',
'mimeapps.list': '',
'node_modules': '',
'procfile': '',
'react.jsx': '',
'user-dirs.dirs': '',
'Makefile': '',
'TODO': '',
'LICENSE': '',
'COPYING': '',
}
def devicon(file):
if file.is_directory:
return dir_node_exact_matches.get(file.relative_path, '')
return file_node_exact_matches.get(
file.relative_path, file_node_extensions.get(file.extension, ''))