Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update to Nerd Fonts 3 code points #264

Merged
merged 2 commits into from
May 7, 2023

Conversation

vlada-dudr
Copy link
Contributor

@vlada-dudr vlada-dudr commented May 1, 2023

Nerd Fonts 3 changed code points of some icons, this updates it according to table here

This will break everyone being on Nerd 2, but without it everyone on version 3 is broken also...

fixes #265

@Flygrounder
Copy link

Flygrounder commented May 1, 2023

I believe, the proper way of handling this is by adding an option in setup. I am not sure though, what should be the default: old version or new as probably most users have not yet upgraded to v3.

@eeeXun
Copy link

eeeXun commented May 1, 2023

Some obsoleted icons didn't change. nerdfix may help.

@carlosala
Copy link

I agree with @Flygrounder, it should be a flag. I'm personally using nf3, but most of the people will be for sure stuck for years in v2.

@luizkowalski
Copy link

just weighing in: according to the Finii from Nerd Font, there should be a "translation" database (under details). I'm not sure if these would be backwards compatible to be honest. Does anyone know?

@carlosala
Copy link

@luizkowalski I'd say there are icons (the ones https://www.nerdfonts.com/cheat-sheet) that are not marked as obsolete and are compatible for both versions.

@Finii
Copy link

Finii commented May 2, 2023

there are icons [...] that are not marked as obsolete and are compatible for both versions

In my opinion it would always be better to not-use the Material Design Icons (also not the new ones), because they do not have a codepoint-stability guarantee, so with the next update the icon on codepoint X could be exchanged 🙄 It does not happen often, but from time to time if you really compare their releases. Maybe by accident.
On the other hand, MDI has so many icons and if you want some very specific one there is only MDI that has it.

I think there is a document about the codepoint stability of the various sets: ryanoasis/nerd-fonts#365 (comment). As project I would prefer icons where upstream guarantees that their codepoints will not change.

@carlosala
Copy link

carlosala commented May 2, 2023

@Finii the problem is what you pointed out. MD added now 7k icons, that are probably quite unique and not replaceable.
Codepoints defined in NF are the standard nowadays, I'd stick to them and I don't think they are going to change in the short term (we have been for a lot of years with the same ones)

@Finii
Copy link

Finii commented May 2, 2023

👍 And I always check (and try to fix if needed) codepoint stability on any upstream update (see for example the octicons update where Nerd Fonts introduces a codepoint stability where there was none upstream).

@vlada-dudr
Copy link
Contributor Author

@luizkowalski: that's what I used to convert.

I was thinking to wrap translation table into lua, but it seemed wasteful to include table of ~1600 entries.

I am curious how implement two sets of icons. I see options:

  1. embedding translation table and when icon is requested do translation
  2. adding extra field into icon definitions for second icon option
  3. make second set of whole icon definition

I am in favour of 3) - easy to drop, easy to generate through translation table from original table in make script.

@rootex-
Copy link

rootex- commented May 2, 2023

Some obsoleted icons didn't change. nerdfix may help.

thanks, nerdfix did help 🤝

@luizkowalski
Copy link

Some obsoleted icons didn't change. nerdfix may help.

thanks, nerdfix did help 🤝

@rootex- mind to share how you did it? I tried nerdfix but it is not working for some reason...

@mehalter
Copy link
Contributor

mehalter commented May 2, 2023

It's also worth noting that the new locations of the material design icons (nf-md-X) are also available in Nerd Fonts v2 with v2.3+. The breaking change that came with v3 simply removed the old locations that were going to be deprecated. So migrating these icons (nf-mdi-X to nf-md-X) will maintain compatibility with the latest v2 and v3. Granted this will not support <v2.3, so I would agree that having a flag for legacy support would be a good idea but keeping the default as using the new v3 icon locations.

@mehalter
Copy link
Contributor

mehalter commented May 2, 2023

You could also just add a comment on the README with the last commit that supported Nerd Fonts v2 which people can use it if they don't want to install (or can't install) Nerd Fonts v3 for whatever reason. It just depends on if you want to continuously maintain support for v2 as new features get added to nvim-web-devicons.

@rootex-
Copy link

rootex- commented May 3, 2023

@luizkowalski

Some obsoleted icons didn't change. nerdfix may help.

thanks, nerdfix did help 🤝

@rootex- mind to share how you did it? I tried nerdfix but it is not working for some reason...

To discover all obsolete symbols in a file:

$ nerdfix check <filename>
note: Found obsolete icon U+F722
  ┌─ filename:1:9
  │
1 │ icon = "",
  │         ^ Icon 'nf-mdi-file_music' is marked as obsolete
  │
  = You could replace it with:
        1. 󰈣 U+F0223 nf-md-file_music
        2. 󰝚 U+F075A nf-md-music
        3. 󰸪 U+F0E2A nf-md-file_music_outline
        4. 󱝟 U+F175F nf-md-archive_music
...
...
...

To fix every obsolete symbol, input a number or search symbols with autocompletion:

$ nerdfix fix <filename>
// prints a prompt for every symbol
note: Found obsolete icon U+F722
  ┌─ filename:1:9
  │
1 │ icon = "",
  │         ^ Icon 'nf-mdi-file_music' is marked as obsolete
  │
  = You could replace it with:
        1. 󰈣 U+F0223 nf-md-file_music
        2. 󰝚 U+F075A nf-md-music
        3. 󰸪 U+F0E2A nf-md-file_music_outline
        4. 󱝟 U+F175F nf-md-archive_music

? Input an icon:
  1
  2
  3
  4
[(Tab) to autocomplete, (Esc) to cancel, (Ctrl-C) to abort]

@vlada-dudr
Copy link
Contributor Author

Thinking about it more, maybe it is ok to merge it. Nerd fonts released version 2.3 earlier this year and deprecated now dropped code points. There are two solutions for people on <=2.2: install newer version (easy), pin commit (easy). Let's just make sure people know what's going on.

@vlada-dudr
Copy link
Contributor Author

I updated readme and reworded commit so it contains exclamation mark

@mehalter
Copy link
Contributor

mehalter commented May 3, 2023

Thinking about it more, maybe it is ok to merge it. Nerd fonts released version 2.3 earlier this year and deprecated now dropped code points. There are two solutions for people on <=2.2: install newer version (easy), pin commit (easy). Let's just make sure people know what's going on.

I think this is a good approach, one comment I would make is it might be a good idea to include the commit hash in the notice of the last commit that supports Nerd Fonts <= 2.2 for people who want to just pin their commit.

@carlosala
Copy link

carlosala commented May 3, 2023

Totally agree

@vlada-dudr
Copy link
Contributor Author

Or maybe let's tag (or branch?) that commit so it is more explicit?

@tapayne88
Copy link
Contributor

Apologies for interrupting your conversation but I think this PR might be missing some icons. When I've run nerdfix locally I've found the following also need updating

  • .babelrc
  • json5
  • pdf
  • log

Could just be my version of nerdfont and/or nerdfix though! 😅

@vlada-dudr
Copy link
Contributor Author

@tapayne88 you can pull request my master if you wish ;)

@tapayne88
Copy link
Contributor

@tapayne88 you can pull request my master if you wish ;)

Hopefully this should do it - vlada-dudr#1 🤞

@vlada-dudr
Copy link
Contributor Author

@tapayne88, so I merged it into my branch.

Now tell me who can move it forward...

@gegoune
Copy link
Collaborator

gegoune commented May 5, 2023

I'll try to review tomorrow.

Thanks to everyone involved!

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for the quick fix!

All changes appear to be mdi ->md which is the most straightforward and correct migration.

RE compatibility: providing setup option / both sets is unnecessary complexity.

A nerd-fonts-2 tag along with documentation / readme should be sufficient, pending @gegoune approval.

@alex-courtis alex-courtis requested a review from gegoune May 6, 2023 04:17
This was referenced May 6, 2023
Copy link
Collaborator

@gegoune gegoune left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nitpicks regarding read me update.

Thanks again!

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@gegoune
Copy link
Collaborator

gegoune commented May 6, 2023

I have just pushed aforementioned compat tag pointing to current master.

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks @vlada-dudr et al for the quick turnaround!

@alex-courtis alex-courtis merged commit 5cd275c into nvim-tree:master May 7, 2023
@redyf
Copy link

redyf commented May 10, 2023

@luizkowalski

Some obsoleted icons didn't change. nerdfix may help.

thanks, nerdfix did help handshake

@rootex- mind to share how you did it? I tried nerdfix but it is not working for some reason...

To discover all obsolete symbols in a file:

$ nerdfix check <filename>
note: Found obsolete icon U+F722
  ┌─ filename:1:9
  │
1 │ icon = "",
  │         ^ Icon 'nf-mdi-file_music' is marked as obsolete
  │
  = You could replace it with:
        1. 󰈣 U+F0223 nf-md-file_music
        2. 󰝚 U+F075A nf-md-music
        3. 󰸪 U+F0E2A nf-md-file_music_outline
        4. 󱝟 U+F175F nf-md-archive_music
...
...
...

To fix every obsolete symbol, input a number or search symbols with autocompletion:

$ nerdfix fix <filename>
// prints a prompt for every symbol
note: Found obsolete icon U+F722
  ┌─ filename:1:9
  │
1 │ icon = "",
  │         ^ Icon 'nf-mdi-file_music' is marked as obsolete
  │
  = You could replace it with:
        1. 󰈣 U+F0223 nf-md-file_music
        2. 󰝚 U+F075A nf-md-music
        3. 󰸪 U+F0E2A nf-md-file_music_outline
        4. 󱝟 U+F175F nf-md-archive_music

? Input an icon:
  1
  2
  3
  4
[(Tab) to autocomplete, (Esc) to cancel, (Ctrl-C) to abort]

This was really helpful, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Icons missing after updating Nerdfonts to v3.0.0