Created
June 9, 2023 05:05
-
-
Save vinnydiehl/8ba79ab80add22be534d3955e5ef000f to your computer and use it in GitHub Desktop.
Script to convert Nerd Fonts from cheatsheet.nvim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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