Skip to content

Instantly share code, notes, and snippets.

@alex-courtis
Last active January 14, 2024 04:17
Show Gist options
  • Save alex-courtis/26271d581e390fe26058bf0743539cc3 to your computer and use it in GitHub Desktop.
Save alex-courtis/26271d581e390fe26058bf0743539cc3 to your computer and use it in GitHub Desktop.
Map nvim-web-devicons To nerd-font
local lunajson = require "lunajson"
local icons_by_filename = require("icons-default").icons_by_filename
local icons_by_file_extension = require("icons-default").icons_by_file_extension
local icons_by_operating_system = require("icons-default").icons_by_operating_system
-- read the json
local f, err, rc = io.open("glyphnames.json", "r")
if not f then
io.stderr:write(string.format("%s\n", err))
os.exit(rc)
end
-- parse the json
local ok, glyphnames = pcall(lunajson.decode, f:read())
f:close()
if not ok then
io.stderr:write(string.format("%s\n", glyphnames))
os.exit(1)
end
---@cast glyphnames table
-- map name by codepoint value
local names_by_codepoint = {}
for name, data in pairs(glyphnames) do
if name and data and data.code then
local code = tonumber(data.code, 16)
if not names_by_codepoint[code] then
names_by_codepoint[code] = {}
end
table.insert(names_by_codepoint[code], name)
end
end
-- calculate codepoint for icons and output the name(s), codepoint, icon and web-devicons name
local function output(icons)
for name, data in pairs(icons) do
local cp = utf8.codepoint(data.icon)
local names = names_by_codepoint[cp] or { "NOGLYPH-" }
local i = 1
for _, n in ipairs(names) do
print(string.format("%-25s %d/%d 0x%05x %s %-25s", n, i, #names, cp, data.icon, name))
i = i + 1
end
end
end
output(icons_by_filename)
output(icons_by_file_extension)
output(icons_by_operating_system)
@alex-courtis
Copy link
Author

alex-courtis commented Jan 14, 2024

./lua audit.lua | sort

cod-azure_devops          1/1 0x0ebe8  azcli                    
cod-code                  1/1 0x0eac4  templ                    
cod-file_binary           1/1 0x0eae8  app                      
cod-file_binary           1/1 0x0eae8  elf                      
cod-file_binary           1/1 0x0eae8  exe                      
cod-file_binary           1/1 0x0eae8  out                      
cod-file_pdf              1/1 0x0eaeb  pdf                      
cod-terminal_linux        1/1 0x0ebc6  linux                    
custom-c                  1/1 0x0e61e  c                        
custom-cpp                1/1 0x0e61d  c++                      
custom-cpp                1/1 0x0e61d  cc                       
custom-cpp                1/1 0x0e61d  cp                       
custom-cpp                1/1 0x0e61d  cpp                      
custom-cpp                1/1 0x0e61d  cxx                      
custom-crystal            1/2 0x0e62f  cr                       
custom-elixir             1/2 0x0e62d  eex                      
custom-elixir             1/2 0x0e62d  ex                       
custom-elixir             1/2 0x0e62d  exs                      
custom-elixir             1/2 0x0e62d  heex                     
custom-elixir             1/2 0x0e62d  leex                     
custom-elixir             1/2 0x0e62d  mix.lock                 
custom-elm                1/2 0x0e62c  elm                      
custom-fennel             1/1 0x0e6af  fnl                      
custom-kotlin             1/2 0x0e634  kt                       
custom-kotlin             1/2 0x0e634  kts                      
custom-orgmode            1/1 0x0e633  org                      
custom-puppet             1/2 0x0e631  epp                      
custom-puppet             1/2 0x0e631  pp                       
custom-toml               1/1 0x0e6b2  toml                     
custom-vim                1/1 0x0e62b  .gvimrc                  
custom-vim                1/1 0x0e62b  _gvimrc                  
custom-vim                1/1 0x0e62b  vim                      
custom-vim                1/1 0x0e62b  .vimrc                   
custom-vim                1/1 0x0e62b  _vimrc                   
custom-v_lang             1/1 0x0e6ac  vsh                      
dev-clojure               1/1 0x0e768  clj                      
dev-clojure               1/1 0x0e768  cljc                     
dev-clojure_alt           1/1 0x0e76a  cljd                     
dev-clojure_alt           1/1 0x0e76a  cljs                     
dev-clojure_alt           1/1 0x0e76a  edn                      
dev-code_badge            1/1 0x0e7a3  cfg                      
dev-code_badge            1/1 0x0e7a3  godot                    
dev-css3                  1/1 0x0e749  css                      
dev-dart                  1/1 0x0e798  dart                     
dev-database              1/1 0x0e706  db                       
dev-database              1/1 0x0e706  dump                     
dev-database              1/1 0x0e706  sql                      
dev-database              1/1 0x0e706  sqlite                   
dev-database              1/1 0x0e706  sqlite3                  
dev-database              1/1 0x0e706  tres                     
dev-dlang                 1/1 0x0e7af  d                        
dev-dropbox               1/1 0x0e707  dropbox                  
dev-erlang                1/1 0x0e7b1  erl                      
dev-erlang                1/1 0x0e7b1  hrl                      
dev-firefox               1/1 0x0e745  xul                      
dev-fsharp                1/1 0x0e7a7  f#                       
dev-fsharp                1/1 0x0e7a7  fs                       
dev-fsharp                1/1 0x0e7a7  fsi                      
dev-fsharp                1/1 0x0e7a7  fsscript                 
dev-fsharp                1/1 0x0e7a7  fsx                      
dev-git                   1/1 0x0e702  commit_editmsg           
dev-git                   1/1 0x0e702  git                      
dev-git                   1/1 0x0e702  .gitattributes           
dev-git                   1/1 0x0e702  .gitignore               
dev-git                   1/1 0x0e702  .gitmodules              
dev-git_compare           1/1 0x0e728  diff                     
dev-gnu                   1/1 0x0e779  gnumakefile              
dev-gnu                   1/1 0x0e779  gnumakefile              
dev-gnu                   1/1 0x0e779  makefile                 
dev-gnu                   1/1 0x0e779  makefile                 
dev-gnu                   1/1 0x0e779  mk                       
dev-html5                 1/1 0x0e736  html                     
dev-illustrator           1/1 0x0e7b4  ai                       
dev-java                  1/1 0x0e738  java                     
dev-nodejs_small          1/1 0x0e718  node_modules             
dev-npm                   1/1 0x0e71e  .npmignore               
dev-npm                   1/1 0x0e71e  .npmrc                   
dev-npm                   1/1 0x0e71e  package.json             
dev-npm                   1/1 0x0e71e  package-lock.json        
dev-perl                  1/1 0x0e769  pl                       
dev-perl                  1/1 0x0e769  pm                       
dev-perl                  1/1 0x0e769  t                        
dev-photoshop             1/1 0x0e7b8  psb                      
dev-photoshop             1/1 0x0e7b8  psd                      
dev-prolog                1/1 0x0e7a1  pro                      
dev-react                 1/1 0x0e7ba  tsx                      
dev-ruby_rough            1/1 0x0e791  brewfile                 
dev-ruby_rough            1/1 0x0e791  config.ru                
dev-ruby_rough            1/1 0x0e791  gemfile$                 
dev-ruby_rough            1/1 0x0e791  gemspec                  
dev-ruby_rough            1/1 0x0e791  rake                     
dev-ruby_rough            1/1 0x0e791  rakefile                 
dev-ruby_rough            1/1 0x0e791  rb                       
dev-rust                  1/1 0x0e7a8  rlib                     
dev-rust                  1/1 0x0e7a8  rs                       
dev-scala                 1/1 0x0e737  sbt                      
dev-scala                 1/1 0x0e737  scala                    
dev-sublime               1/1 0x0e7aa  sublime                  
dev-swift                 1/1 0x0e755  swift                    
dev-swift                 1/1 0x0e755  xcplayground             
dev-terminal              1/1 0x0e795  awk                      
dev-terminal              1/1 0x0e795  bash                     
dev-terminal              1/1 0x0e795  csh                      
dev-terminal              1/1 0x0e795  fish                     
dev-terminal              1/1 0x0e795  ksh                      
dev-terminal              1/1 0x0e795  sh                       
dev-terminal              1/1 0x0e795  zsh                      
dev-ubuntu                1/1 0x0e73a  ubuntu                   
dev-visualstudio          1/1 0x0e70c  .settings.json           
dev-visualstudio          1/1 0x0e70c  sln                      
dev-visualstudio          1/1 0x0e70c  suo                      
fa-apple                  1/1 0x0f179  applescript              
fa-connectdevelop         1/1 0x0f20e  gql                      
fa-connectdevelop         1/1 0x0f20e  graphql                  
fa-cube                   1/1 0x0f1b2  glb                      
fa-desktop                1/1 0x0f108  desktop                  
fae-brain                 1/1 0x0e28c  drl                      
fae-tree                  1/1 0x0e21c  query                    
fa-exchange               1/1 0x0f0ec  hurl                     
fa-file                   1/1 0x0f15b  tfvars                   
fa-font                   1/1 0x0f031  eot                      
fa-font                   1/1 0x0f031  otf                      
fa-font                   1/1 0x0f031  ttf                      
fa-font                   1/1 0x0f031  woff                     
fa-font                   1/1 0x0f031  woff2                    
fa-gitlab                 1/1 0x0f296  .gitlab-ci.yml           
fa-h_square               1/1 0x0f0fd  h                        
fa-h_square               1/1 0x0f0fd  hh                       
fa-h_square               1/1 0x0f0fd  hpp                      
fa-h_square               1/1 0x0f0fd  hxx                      
fa-linode                 1/1 0x0f2b8  vagrantfile$             
fa-music                  1/1 0x0f001  aac                      
fa-music                  1/1 0x0f001  flac                     
fa-music                  1/1 0x0f001  m4a                      
fa-music                  1/1 0x0f001  mp3                      
fa-music                  1/1 0x0f001  ogg                      
fa-music                  1/1 0x0f001  wav                      
fa-paperclip              1/1 0x0f0c6  import                   
fa-unlock_alt             1/1 0x0f13e  lock                     
fa-video_camera           1/1 0x0f03d  m4v                      
fa-video_camera           1/1 0x0f03d  mkv                      
fa-video_camera           1/1 0x0f03d  mov                      
fa-video_camera           1/1 0x0f03d  mp4                      
fa-video_camera           1/1 0x0f03d  webm                     
fa-windows                1/1 0x0f17a  windows                  
linux-almalinux           1/1 0x0f31d  alma                     
linux-alpine              1/1 0x0f300  alpine                   
linux-aosc                1/1 0x0f301  aosc                     
linux-artix               1/1 0x0f31f  artix                    
linux-budgie              1/1 0x0f320  budgie                   
linux-centos              1/1 0x0f304  centos                   
linux-debian              1/1 0x0f306  debian                   
linux-deepin              1/1 0x0f321  deepin                   
linux-devuan              1/1 0x0f307  devuan                   
linux-elementary          1/1 0x0f309  elementary               
linux-endeavour           1/1 0x0f322  endeavour                
linux-fedora              1/1 0x0f30a  fedora                   
linux-freebsd             1/1 0x0f30c  freebsd                  
linux-gnu_guix            1/1 0x0f325  guix                     
linux-illumos             1/1 0x0f326  illumos                  
linux-kali_linux          1/1 0x0f327  kali                     
linux-mageia              1/1 0x0f310  mageia                   
linux-manjaro             1/1 0x0f312  manjaro                  
linux-nixos               1/1 0x0f313  nix                      
linux-nixos               1/1 0x0f313  nixos                    
linux-openbsd             1/1 0x0f328  openbsd                  
linux-opensuse            1/1 0x0f314  opensuse                 
linux-parrot              1/1 0x0f329  parrot                   
linux-pop_os              1/1 0x0f32a  pop_os                   
linux-raspberry_pi        1/1 0x0f315  raspberry_pi             
linux-rocky_linux         1/1 0x0f32b  rocky                    
linux-sabayon             1/1 0x0f317  sabayon                  
linux-slackware           1/1 0x0f318  slackware                
linux-solus               1/1 0x0f32d  solus                    
linux-void                1/1 0x0f32e  void                     
linux-zorin               1/1 0x0f32f  zorin                    
md-arch                   1/1 0xf08c7 󰣇 arch                     
md-bookshelf              1/1 0xf125f 󱉟 bib                      
md-chess_knight           1/1 0xf0858 󰡘 huff                     
md-docker                 1/1 0xf0868 󰡨 compose.yaml             
md-docker                 1/1 0xf0868 󰡨 compose.yml              
md-docker                 1/1 0xf0868 󰡨 containerfile            
md-docker                 1/1 0xf0868 󰡨 docker-compose.yaml      
md-docker                 1/1 0xf0868 󰡨 docker-compose.yml       
md-docker                 1/1 0xf0868 󰡨 dockerfile               
md-docker                 1/1 0xf0868 󰡨 Dockerfile               
md-docker                 1/1 0xf0868 󰡨 .dockerignore            
md-dot_net                1/1 0xf0aae 󰪮 csproj                   
md-feather                1/1 0xf06d3 󰛓 tbc                      
md-feather                1/1 0xf06d3 󰛓 tcl                      
md-file_document          1/1 0xf0219 󰈙 csv                      
md-file_document          1/1 0xf0219 󰈙 txt                      
md-file_excel             1/1 0xf021b 󰈛 xls                      
md-file_excel             1/1 0xf021b 󰈛 xlsx                     
md-file_music             1/1 0xf0223 󰈣 opus                     
md-file_powerpoint        1/1 0xf0227 󰈧 ppt                      
md-file_word              1/1 0xf022c 󰈬 doc                      
md-file_word              1/1 0xf022c 󰈬 docx                     
md-gentoo                 1/1 0xf08e8 󰣨 gentoo                   
md-image_filter_hdr       1/1 0xf0509 󰔉 material                 
md-lambda                 1/1 0xf0627 󰘧 scm                      
md-language_csharp        1/1 0xf031b 󰌛 cs                       
md-language_fortran       1/1 0xf121a 󱈚 f90                      
md-language_javascript    1/1 0xf031e 󰌞 cjs                      
md-language_javascript    1/1 0xf031e 󰌞 js                       
md-language_javascript    1/1 0xf031e 󰌞 mjs                      
md-language_r             1/1 0xf07d4 󰟔 r                        
md-language_r             1/1 0xf07d4 󰟔 r                        
md-language_r             1/1 0xf07d4 󰟔 R                        
md-language_r             1/1 0xf07d4 󰟔 R                        
md-language_xaml          1/1 0xf0673 󰙳 xaml                     
md-leaf                   1/1 0xf032a 󰌪 mint                     
md-library                1/1 0xf0331 󰌱 log                      
md-linux_mint             1/1 0xf08ed 󰣭 mint                     
md-memory                 1/1 0xf035b 󰍛 sv                       
md-memory                 1/1 0xf035b 󰍛 svh                      
md-memory                 1/1 0xf035b 󰍛 v                        
md-memory                 1/1 0xf035b 󰍛 vh                       
md-memory                 1/1 0xf035b 󰍛 vhd                      
md-memory                 1/1 0xf035b 󰍛 vhdl                     
md-movie                  1/1 0xf0381 󰎁 tscn                     
md-powershell             1/1 0xf0a0a 󰨊 ps1                      
md-powershell             1/1 0xf0a0a 󰨊 psd1                     
md-powershell             1/1 0xf0a0a 󰨊 psm1                     
md-razor_double_edge      1/1 0xf1997 󱦗 cshtml                   
md-razor_single_edge      1/1 0xf1998 󱦘 razor                    
md-redhat                 1/1 0xf111b 󱄛 redhat                   
md-svg                    1/1 0xf0721 󰜡 svg                      
md-tailwind               1/1 0xf13ff 󱏿 tailwind.config.js       
md-text_shadow            1/1 0xf0669 󰙩 tex                      
md-vector_rectangle       1/1 0xf05c6 󰗆 rproj                    
md-webpack                1/1 0xf072b 󰜫 webpack                  
md-webpack                1/1 0xf072b 󰜫 webpack                  
md-xml                    1/1 0xf05c0 󰗀 xml                      
NOGLYPH-                  1/1 0x003bb λ sig                      
NOGLYPH-                  1/1 0x003bb λ sml                      
NOGLYPH-                  1/1 0x0221e ∞ mo                       
NOGLYPH-                  1/1 0x02699 ⚙ cbl                      
NOGLYPH-                  1/1 0x02699 ⚙ cob                      
NOGLYPH-                  1/1 0x02699 ⚙ cobol                    
NOGLYPH-                  1/1 0x02699 ⚙ cpy                      
oct-beaker                1/1 0x0f499  spec.js                  
oct-beaker                1/1 0x0f499  spec.jsx                 
oct-beaker                1/1 0x0f499  spec.ts                  
oct-beaker                1/1 0x0f499  spec.tsx                 
oct-beaker                1/1 0x0f499  test.js                  
oct-beaker                1/1 0x0f499  test.jsx                 
oct-beaker                1/1 0x0f499  test.ts                  
oct-beaker                1/1 0x0f499  test.tsx                 
oct-markdown              1/1 0x0f48a  md                       
oct-markdown              1/1 0x0f48a  mdx                      
oct-package               1/1 0x0f487  pck                      
oct-sliders               1/1 0x0f462  .env                     
oct-terminal              1/1 0x0f489  terminal                 
seti-apple                1/1 0x0e635  apple                    
seti-bazel                1/1 0x0e63a  bazel                    
seti-bazel                1/1 0x0e63a  build                    
seti-bazel                1/1 0x0e63a  bzl                      
seti-bazel                1/1 0x0e63a  workspace                
seti-cjsx                 1/2 0x0e61b  coffee                   
seti-coffee               2/2 0x0e61b  coffee                   
seti-config               1/1 0x0e615  .bash_profile            
seti-config               1/1 0x0e615  .bashrc                  
seti-config               1/1 0x0e615  bat                      
seti-config               1/1 0x0e615  cmake                    
seti-config               1/1 0x0e615  cmakelists.txt           
seti-config               1/1 0x0e615  conf                     
seti-config               1/1 0x0e615  .ds_store                
seti-config               1/1 0x0e615  gd                       
seti-config               1/1 0x0e615  .gitconfig               
seti-config               1/1 0x0e615  ini                      
seti-config               1/1 0x0e615  .luaurc                  
seti-config               1/1 0x0e615  yaml                     
seti-config               1/1 0x0e615  yml                      
seti-config               1/1 0x0e615  .zprofile                
seti-config               1/1 0x0e615  .zshenv                  
seti-config               1/1 0x0e615  .zshrc                   
seti-crystal              2/2 0x0e62f  cr                       
seti-css                  1/1 0x0e614  less                     
seti-editorconfig         1/1 0x0e652  .editorconfig            
seti-elixir               2/2 0x0e62d  eex                      
seti-elixir               2/2 0x0e62d  ex                       
seti-elixir               2/2 0x0e62d  exs                      
seti-elixir               2/2 0x0e62d  heex                     
seti-elixir               2/2 0x0e62d  leex                     
seti-elixir               2/2 0x0e62d  mix.lock                 
seti-elm                  2/2 0x0e62c  elm                      
seti-eslint               1/1 0x0e655  .eslintignore            
seti-eslint               1/1 0x0e655  .eslintrc                
seti-ethereum             1/1 0x0e656  sol                      
seti-favicon              1/1 0x0e623  favicon.ico              
seti-go                   1/1 0x0e627  go                       
seti-grunt                1/1 0x0e611  gruntfile                
seti-gulp                 1/1 0x0e610  gulpfile                 
seti-haskell              1/1 0x0e61f  hs                       
seti-haskell              1/1 0x0e61f  lhs                      
seti-heroku               1/1 0x0e607  procfile                 
seti-html                 1/1 0x0e60e  ejs                      
seti-html                 1/1 0x0e60e  erb                      
seti-html                 1/1 0x0e60e  haml                     
seti-html                 1/1 0x0e60e  htm                      
seti-html                 1/1 0x0e60e  slim                     
seti-image                1/1 0x0e60d  avif                     
seti-image                1/1 0x0e60d  bmp                      
seti-image                1/1 0x0e60d  gif                      
seti-image                1/1 0x0e60d  ico                      
seti-image                1/1 0x0e60d  jpeg                     
seti-image                1/1 0x0e60d  jpg                      
seti-image                1/1 0x0e60d  jxl                      
seti-image                1/1 0x0e60d  png                      
seti-image                1/1 0x0e60d  webp                     
seti-json                 1/2 0x0e60b  .babelrc                 
seti-json                 1/2 0x0e60b  cson                     
seti-json                 1/2 0x0e60b  json                     
seti-json                 1/2 0x0e60b  json5                    
seti-json                 1/2 0x0e60b  jsonc                    
seti-json                 1/2 0x0e60b  nswag                    
seti-json                 1/2 0x0e60b  webmanifest              
seti-julia                1/1 0x0e624  jl                       
seti-kotlin               2/2 0x0e634  kt                       
seti-kotlin               2/2 0x0e634  kts                      
seti-less                 2/2 0x0e60b  .babelrc                 
seti-less                 2/2 0x0e60b  cson                     
seti-less                 2/2 0x0e60b  json                     
seti-less                 2/2 0x0e60b  json5                    
seti-less                 2/2 0x0e60b  jsonc                    
seti-less                 2/2 0x0e60b  nswag                    
seti-less                 2/2 0x0e60b  webmanifest              
seti-license              1/1 0x0e60a  copying                  
seti-license              1/1 0x0e60a  copying.lesser           
seti-license              1/1 0x0e60a  license                  
seti-license              1/1 0x0e60a  license                  
seti-license              1/1 0x0e60a  unlicense                
seti-liquid               1/1 0x0e670  liquid                   
seti-lua                  1/1 0x0e620  lua                      
seti-lua                  1/1 0x0e620  luau                     
seti-markdown             1/1 0x0e609  markdown                 
seti-markdown             1/1 0x0e609  rmd                      
seti-markdown             1/1 0x0e609  rmd                      
seti-mustache             1/1 0x0e60f  hbs                      
seti-mustache             1/1 0x0e60f  mustache                 
seti-nim                  1/1 0x0e677  nim                      
seti-ocaml                1/1 0x0e67a  ml                       
seti-ocaml                1/1 0x0e67a  mli                      
seti-php                  1/1 0x0e608  php                      
seti-prisma               1/1 0x0e684  prisma                   
seti-puppet               2/2 0x0e631  epp                      
seti-puppet               2/2 0x0e631  pp                       
seti-python               1/1 0x0e606  pxd                      
seti-python               1/1 0x0e606  pxi                      
seti-python               1/1 0x0e606  py                       
seti-python               1/1 0x0e606  pyc                      
seti-python               1/1 0x0e606  pyd                      
seti-python               1/1 0x0e606  pyi                      
seti-python               1/1 0x0e606  pyo                      
seti-python               1/1 0x0e606  py.typed                 
seti-python               1/1 0x0e606  pyx                      
seti-react                1/1 0x0e625  jsx                      
seti-rescript             1/1 0x0e688  res                      
seti-rescript             1/1 0x0e688  resi                     
seti-sass                 1/1 0x0e603  sass                     
seti-sass                 1/1 0x0e603  scss                     
seti-stylus               1/1 0x0e600  styl                     
seti-svelte               1/1 0x0e697  svelte                   
seti-svelte               1/1 0x0e697  svelte.config.js         
seti-terraform            1/1 0x0e69a  tf                       
seti-tsconfig             1/1 0x0e69d  tsconfig.json            
seti-twig                 1/1 0x0e61c  twig                     
seti-typescript           1/1 0x0e628  cts                      
seti-typescript           1/1 0x0e628  mts                      
seti-typescript           1/1 0x0e628  ts                       
seti-vala                 1/1 0x0e69e  vala                     
seti-vue                  1/1 0x0e6a0  vue                      
seti-wasm                 1/1 0x0e6a1  wasm                     
seti-xml                  1/1 0x0e619  rss                      
seti-zig                  1/1 0x0e6a9  zig                      

@alex-courtis
Copy link
Author

./lua audit.lua | sed -E 's/([^-]-).*/\1/g' | sort | uniq -c | sort -n

      2 fae-
      7 NOGLYPH-
      8 cod-
     13 oct-
     27 custom-
     31 linux-
     32 fa-
     58 md-
     76 dev-
    122 seti-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment