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

feat: add audio file icons, remove audio/video from vim filetypes #410

Merged
merged 26 commits into from
Apr 28, 2024

Conversation

pauchiner
Copy link
Contributor

@pauchiner pauchiner commented Mar 3, 2024

Closes #404

Preview

Roadmap:

  • .aac (Advanced Audio Coding)
  • .aiff or .aif (Audio Interchange File Format)
  • .ape (Monkey's Audio)
  • .flac (Free Lossless Audio Codec)
  • .mp3 (MPEG-1 Audio Layer)
  • .m4a (MPEG-4 Audio)
  • .opus (Opus Audio File)
  • .ogg (Ogg Vorbis)
  • .wav (Waveform Audio File Format)
  • .wma (Windows Media Audio)

@pauchiner pauchiner marked this pull request as draft March 3, 2024 22:15
@pauchiner pauchiner marked this pull request as ready for review March 4, 2024 12:28
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.

Looking good; let's add the rest #404 (comment)

@pauchiner pauchiner changed the title feat: add mp3 file icons feat: add audio file icons Mar 6, 2024
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.

These are looking good, however they should actually be in the icons_by_file_extension table.

There are already some of these extensions in there... including mp3.

I'll be grateful if you could move the new ones in there, overwriting.

However... the existing ones are using nf-fa-music. We'll need to use that one, to avoid a breaking change.

@pauchiner
Copy link
Contributor Author

Sorry, I made those commits in a few free minutes yesterday, I didn't notice either the extensions table or the breaking changes, I'm already working on fixing it.

@alex-courtis
Copy link
Member

Looking good: :NvimWebDeviconsHiTest

However I think we might be backwards here: all the new icons are in icons_by_filename wheras they should be in icons_by_file_extension. The user will be finding music file icons via get_icon with an extension rather than matching an exact file name.

The filetypes will still correctly map to icons_by_file_extension.

@alex-courtis
Copy link
Member

Any updates @pauchiner ? This is really close...

@pauchiner
Copy link
Contributor Author

Sorry, I was absent due to personal things, as soon as I can I will make a commit with the changes.

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.

Looking good, a couple of tidies needed.

lua/nvim-web-devicons/icons-default.lua Outdated Show resolved Hide resolved
@@ -246,6 +249,7 @@ local filetypes = {
["vue"] = "vue",
["wasm"] = "wasm",
["wav"] = "wav",
["wma"] = "wma",
Copy link
Member

Choose a reason for hiding this comment

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

The above aren't vim filetypes so should not be mapped to extensions.

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.

Still not quite there...

None of these file types correspond to vim syntax &ft, see /usr/share/nvim/runtime/syntax

We need to remove them from the mapping

-- Map of filetypes -> icon names
local filetypes = {

@pauchiner
Copy link
Contributor Author

So if aren't vim filetypes, how are mapped?
I think im not understanding your point, Sorry.

@alex-courtis
Copy link
Member

So if aren't vim filetypes, how are mapped? I think im not understanding your point, Sorry.

No worries; this is not very clear from the names.

Files like these are simply mapped by their extension against the keys of icons_by_file_extension. There's no need for any extra mapping.

Try

:lua print(require("nvim-web-devicons").get_icon("aiff"))

@hasecilu
Copy link
Collaborator

I'm not really sure if PCM file extension is really used, so could be added.

@pauchiner
Copy link
Contributor Author

I have already deleted the filetypes that I added at the time, but then by the same logic, those that were previously there should also be deleted, such as mp3, mp4, wav...

@alex-courtis
Copy link
Member

I have already deleted the filetypes that I added at the time, but then by the same logic, those that were previously there should also be deleted, such as mp3, mp4, wav...

Good catch! Yes, they should be removed.

In the interest of speed, I'll push that change to this branch.

@alex-courtis alex-courtis changed the title feat: add audio file icons feat: add audio file icons, remove audio/video from vim filetypes Apr 28, 2024
@alex-courtis
Copy link
Member

I'm not really sure if PCM file extension is really used, so could be added.

Sounds good! Any others you think of please do raise a PR...

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 your contribution and many thanks for bearing with all the back and forth.

@alex-courtis alex-courtis merged commit 4f86aad into nvim-tree:master Apr 28, 2024
5 checks passed
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.

Add mp3 file icons
3 participants