File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 2424 out . puts " \\ }"
2525 out . puts
2626
27- out . puts 'let s:nerdfonts = {'
2827 nerdfonts = Hash . new { |h , k | h [ k ] = [ ] }
29- URI . open ( ARGV . first || 'https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/css/nerd-fonts-generated.css' ) do |f |
30- f . read . scan ( /\. ([\w -]*):before {\s *content: "\\ (\w *)";\s *}/ ) { |classname , codepoint |
31- nerdfonts [ codepoint ] << classname
32- }
33- nerdfonts . sort_by { |( k , v ) | k . to_i ( 16 ) } . each do |( code , names ) |
34- out . puts " \\ 0x#{ code } : [" + names . map { |n | "'#{ n } '" } . join ( ', ' ) + '],'
28+ URI . open ( ARGV [ 1 ] || 'https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/glyphnames.json' ) do |f |
29+ JSON . parse ( f . read ) . each do |( name , subkey ) |
30+ code = subkey [ 'code' ]
31+ next unless code
32+ nerdfonts [ code ] << "nf-#{ name } "
3533 end
3634 end
35+ out . puts 'let s:nerdfonts = {'
36+ nerdfonts . sort_by { |( k , v ) | k . to_i ( 16 ) } . each do |( code , names ) |
37+ out . puts " \\ 0x#{ code } : [" + names . map { |n | "'#{ n } '" } . join ( ', ' ) + '],'
38+ end
3739 out . puts " \\ }"
3840 out . puts
3941
You can’t perform that action at this time.
0 commit comments