Skip to content

Instantly share code, notes, and snippets.

@vinnydiehl
Created June 9, 2023 05:05
Show Gist options
  • Save vinnydiehl/8ba79ab80add22be534d3955e5ef000f to your computer and use it in GitHub Desktop.
Save vinnydiehl/8ba79ab80add22be534d3955e5ef000f to your computer and use it in GitHub Desktop.
Script to convert Nerd Fonts from cheatsheet.nvim
#!/usr/bin/env ruby
results = Dir.glob("#{ARGV.first}/*").sort.map do |filename|
File.read(filename).split("\n").select { |ln| ln =~ /^\s+\(/ }.map do |ln|
name, code = ln.scan /(?<=")[\w\\x-]+(?=")/
code = code.sub("\\x", "0x").hex
"#{name.sub /^nf-/, ""} | #{[code].pack("U")}"
end
end.flatten
File.open("results", "w") do |f|
f.write results.sort.join("\n")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment