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 many icons #433

Merged
merged 12 commits into from
Apr 9, 2024
Merged

Conversation

hasecilu
Copy link
Collaborator

@hasecilu hasecilu commented Apr 3, 2024

Still WIP I'm looking at more icons, I want to hear some ideas.
Also I'm waiting for new Nerd Fonts release that includes some new icons. 3.2.0 ver. released, I included the KDE, posmarketOS & Qt logos that are new.

https://github.com/ryanoasis/nerd-fonts/releases/tag/v3.2.0


For example in:

local filetypes = {
  ["avif"] = "avif",
  ["bzl"] = "bzl",
...
}

Would be possible to create groups, for example create a single icon entry and use it various times for different file extensions to simplify the code? For example the open PR with music extensions, maybe a group of video, compressed files. In my case in this PR check the FreeCAD and KiCad extensions.

Something like:

local filetypes = {
...
  ["fcmacro"] = "freecad",
  ["fcmat"] = "freecad",
  ["fcparam"] = "freecad",
  ["fcstd"] = "freecad",
...
}

@hasecilu hasecilu changed the title More icons, mainly from font-logos feat: add more icon asociations, mainly from font-logos Apr 6, 2024
@hasecilu
Copy link
Collaborator Author

hasecilu commented Apr 7, 2024

Rebased, I think now only need to update local filetypes = {}

@alex-courtis
Copy link
Member

Looking good...

Some of the darks ones are... too dark to see.

XTerm.vt100.reverseVideo:	true
XTerm.termName:	xterm-256color

20240407_130819

XTerm.vt100.reverseVideo:	true
XTerm.termName:	xterm-direct

20240407_130925

I encountered the same with linux and fixed them here: #408

I just poked around the website until I found another theme colour that was more dark friendly.

@alex-courtis
Copy link
Member

Fails at startup when using xterm defaults i.e. nothing in xrdb. Master is OK.

xterm -rv is OK.

Error detected while processing VimEnter Autocommands for "*":
E5108: Error executing lua [string ":lua"]:1: VimEnter Autocommands for "*"..OptionSet Autocommands for "background": Vim(append):Error executing lua callback: vim/shared.lua:0: after the second argument: expected table, got nil
stack traceback:
        [C]: in function 'error'
        vim/shared.lua: in function 'validate'
        vim/shared.lua: in function 'tbl_extend'
        ...ite/pack/packer/start/hasecilu/lua/nvim-web-devicons.lua:39: in function 'refresh_icons'
        ...ite/pack/packer/start/hasecilu/lua/nvim-web-devicons.lua:567: in function <...ite/pack/packer/start/hasecilu/lua/nvim-web-devicons.lua:566>
        [C]: in function '__newindex'
        [string ":lua"]:1: in main chunk
stack traceback:
        [C]: in function '__newindex'
        [string ":lua"]:1: in main chunk
Press ENTER or type command to continue

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.

This is looking really good!

There are two unrelated changes here: adding the two new classes of icons and adding new icons. Let's split into two PRs please.

Use the Godot logo on different files that are used on this program.
- BSPWM
- GTK
- Hyprland
- i3
- LXDE
- LxQt
- Mpv
- Prusa Slicer
- sxhkdrc
- VLC
- Weston
- Xmonad
Different usecases.
Added `.3mf`, `.fbx`, `.obj`, `.ply` and `.stl` file extensions.
@hasecilu
Copy link
Collaborator Author

hasecilu commented Apr 8, 2024

I was about to update local filetypes = {} but I noticed that a lot of extensions are missing and even some don't appear in the table as "dosbatch", what's the diffenrence for filetype and file extension?

@alex-courtis
Copy link
Member

what's the diffenrence for filetype and file extension?

It's just a mapping of vim filetypes to something - extension, name, os

It's not well maintained.

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 so far, only small nits.

My concentration is flagging now. I'll look at the rest tomorrow.

lua/nvim-web-devicons/icons-default.lua Outdated Show resolved Hide resolved
lua/nvim-web-devicons/icons-default.lua Show resolved Hide resolved
lua/nvim-web-devicons/icons-default.lua Show resolved Hide resolved
lua/nvim-web-devicons/icons-default.lua Show resolved Hide resolved
lua/nvim-web-devicons/icons-default.lua Outdated Show resolved Hide resolved
lua/nvim-web-devicons/icons-default.lua Show resolved Hide resolved
lua/nvim-web-devicons/icons-default.lua Show resolved Hide resolved
@hasecilu hasecilu marked this pull request as ready for review April 8, 2024 23:50
@alex-courtis
Copy link
Member

This is working now. Everything is following existing patterns so not worth digging deeper...

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.

Review complete, small changes only.

Please don't resolve conversations. I'll do that so that I can review and mark the subsequent changes.

Edit: please lighten

  • gcode
  • xpi
  • archlabs

- Add G icon for `.gcode` file extension. These files are used on 3D
    printers and CNC machines.
- Add icon to `.bin` file extension.
- Add PlatformIO icon for `platformio.ini` settings file.
- Add 0x icon to `.hex` files.
- Add square wave to extensions for logic analyzer sessions.
  - `.sal` is for propietary Saleae format.
  - `.sr` is for open source Sigrok/Pulseview format.
- `.gresource` file extension.
- `.jwmrc` file extension for JWM.
- `.msf` for some Thunderbird files.
- `.ui` file extension.
- `.xcf` file extension for GIMP
- Add icon for several KiCad file extensions. Free software suite for
electronic design automation (EDA).
  - `.kicad_pro` Project file, containing settings that are shared
between the schematic and PCB.
  - `.kicad_sch` Schematic files containing all info and the components
themselves.
  - `.kicad_sym` Schematic symbol library file, containing the component
descriptions: graphic shape, pins, fields.
  - `.kicad_pcb` Board file containing all info but the page layout.
  - `.kicad_mod` Footprint files, containing one footprint description
each.
  - `.kicad_dru` Design rules file, containing custom design rules for a
certain .kicad_pcb file.
  - `.kicad_prl` Local settings for the current project; helps Kicad
remember the last used settings such as layer visibility or selection
filter.
  - `.kicad_wks` Page layout (drawing border and title block)
description file.
  - `sym-lib-table` Symbol library table: list of symbol libraries
available in the schematic editor.Board editor files and folders.
  - `fp-lib-table` Footprint library table: list of footprint libraries
available in the board editor.
  - `fp-info-cache` Cache to speed up loading of footprint libraries.
  - Note: Legacy file extensions were ignored, also `.net` and `.cmp`
extensions (kind of generic).
- Git
- KDE config file
- Kdenlive
- Krita
- X.org
- Video icons were changed to `nf-seti-video`
- Add icon for several FreeCAD file extensions. General-purpose parametric 3D computer-aided design (CAD) modeler.
  - `.fcstd` FreeCAD native format.
  - `.fcmacro` FreeCAD macro (Python code).
  - `.fcmat` FreeCAD material card.
  - `.fcparam` FreeCAD parameter file.
  - `.fcscript` FreeCAD script (Python code).
  - `.fctb` Path tool bit file (JSON format).
  - `.fctl` Path tool library file (JSON format).
  - `.fcbak` FreeCAD Backup file.
  - `.fcstd1` FreeCAD Backup file.
  - `FreeCAD.conf` Configuration file.
@hasecilu
Copy link
Collaborator Author

hasecilu commented Apr 9, 2024

More changes, let me know if something is missing

@alex-courtis
Copy link
Member

There are some vim filetype mappings we can add e.g. gtkrc

Can you please look through /usr/share/nvim/runtime/syntax and find any others to map?

@hasecilu
Copy link
Collaborator Author

hasecilu commented Apr 9, 2024

Sure, maybe an instruction to redirect to /usr/share/nvim/runtime/syntax would be useful

@alex-courtis
Copy link
Member

Sure, maybe an instruction to redirect to /usr/share/nvim/runtime/syntax would be useful

Sorry, I mean add them to

-- Map of filetypes -> icon names
local filetypes = {
  ["avif"] = "avif",

@hasecilu
Copy link
Collaborator Author

hasecilu commented Apr 9, 2024

What I meant it was to put an instructions for contributors that doesn't know of the existance of those files, like me 😅
I used this to find coincidences:

lua_file="$HOME/git/github/nvim-web-devicons/lua/nvim-web-devicons/icons-default.lua"
ft="$HOME/git/github/nvim-web-devicons/lua/nvim-web-devicons.lua"
while IFS= read -r line; do
if [[ $line =~ \[\"(.+)\"\] ]]; then
	key="${BASH_REMATCH[1]}"
	# Search for the key in the main file
	line=$(grep -F "\"$key\"" "$ft")
	if [ -n "$line" ]; then
		continue
	else
		# echo "$key" | lolcat
		[ -f "/usr/share/nvim/runtime/syntax/$key.vim" ] && echo "$key.vim"
	fi
fi
done <"$lua_file"

@alex-courtis
Copy link
Member

What I meant it was to put an instructions for contributors that doesn't know of the existance of those files, like me 😅 I used this to find coincidences:

lua_file="$HOME/git/github/nvim-web-devicons/lua/nvim-web-devicons/icons-default.lua"
ft="$HOME/git/github/nvim-web-devicons/lua/nvim-web-devicons.lua"
while IFS= read -r line; do
if [[ $line =~ \[\"(.+)\"\] ]]; then
	key="${BASH_REMATCH[1]}"
	# Search for the key in the main file
	line=$(grep -F "\"$key\"" "$ft")
	if [ -n "$line" ]; then
		continue
	else
		# echo "$key" | lolcat
		[ -f "/usr/share/nvim/runtime/syntax/$key.vim" ] && echo "$key.vim"
	fi
fi
done <"$lua_file"

Oh nice. Maybe drop it in scripts. There's an existing one but it doesn't seem to be very useful.

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 this outstanding contribution!

Next time please, please smaller PRs.

@alex-courtis alex-courtis changed the title feat: add more icon asociations, mainly from font-logos feat: add many icons Apr 9, 2024
@alex-courtis alex-courtis merged commit fd4abfc into nvim-tree:master Apr 9, 2024
5 checks passed
@tp86 tp86 mentioned this pull request Apr 9, 2024
@hasecilu hasecilu deleted the feat/more_icons branch April 9, 2024 13:48
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.

2 participants