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

Extend icon coverage on remotes and file extensions #3484

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

hasecilu
Copy link

@hasecilu hasecilu commented Apr 7, 2024

  • PR Description

Initially I opened #3426 issue, this PR is targeted to fix that.

  • Please check if the PR fulfills these requirements
  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • Docs (specifically docs/Config.md) have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

This is the result from the remote icons that I posted on the issue.
Note: The FreeBSD only is triggered if the remote is "git.FreeBSD.org", note the capitalization

Edit: btw, there are also icons for gitea -> nf-linux-gitea, \uf339,  and forgejo -> nf-linux-forgejo, \uf335,  if someone is interested on some instances that use that sofware.

image

Would be nice if in the future the user can make overrides via config file.

icon_overrides:
  filenames:
    Cargo.toml: 🦀
    Cargo.lock: 🦀
  extensions:
    rs: 🦀
    nix: 

Fix #3426

@hasecilu hasecilu marked this pull request as ready for review April 7, 2024 23:59
Copy link
Owner

@jesseduffield jesseduffield left a comment

Choose a reason for hiding this comment

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

LGTM, great work

@hasecilu
Copy link
Author

hasecilu commented Apr 9, 2024

I used this script to get the asociations from https://github.com/nvim-tree/nvim-web-devicons, before running the script I removed the dots from the file extensions on file_icons.go.

#!/usr/bin/env bash
go_file="$HOME/git/github/lazygit/pkg/gui/presentation/icons/file_icons.go"
lua_file="$HOME/git/github/nvim-web-devicons/lua/nvim-web-devicons/icons-default.lua"
# Print keys that are missing on lazygit with go formatting
while IFS= read -r line; do
if [[ $line =~ \[\"(.+)\"\] ]]; then
	key="${BASH_REMATCH[1]}"
	# Search for the key in the Rust file
	go_line=$(grep -F "\"$key\"" "$go_file")
	if [ -n "$go_line" ]; then
		found=1
	else
		found=0
		spaces1=$(printf '%*s' $((19 - ${#key})) "")
		echo -en "\t\"$key\":$spaces1{Icon: \"\u"
	fi
elif [[ $line =~ "    icon = " ]]; then
	if [ $found -eq 0 ]; then
		glyph=$(echo $line | cut -d \" -f2 | cut -d \" -f1)
		unicode_length=$(printf "%04x" "'$glyph" | wc -c)
		printf "%04x" "'$glyph"
		echo -n '", Color: '
	fi
elif [[ $line =~ "    color = " ]]; then
	continue
elif [[ $line =~ "    cterm_color = " ]]; then
	if [ $found -eq 0 ]; then
		# Extract color
		color=$(echo $line | cut -d \" -f2 | cut -d \" -f1)
		echo "$color}, // $glyph"
	fi
elif [[ $line =~ "    name = " ]]; then
	continue
fi
done <"$lua_file"

Since nvim-tree is a file browser it also have a lot of icon associations for a lot of files like config files, those make sense in a file browser (also in eza) but not much on lazygit... unless someone is sharing their config files on a git repo? (maybe a riced hyprland.conf), would you like to add those extra files?

Below I add a list of files and extensions, for the extensions there are a lot I don't know so I didn't included them.

Click to toggle visibility of extra associations
    "build.gradle":       {Icon: "\ue660", Color: 24}, // 
    "settings.gradle":    {Icon: "\ue660", Color: 24}, // 
    ".babelrc":           {Icon: "\ue60b", Color: 185}, // 
    ".bash_profile":      {Icon: "\ue615", Color: 113}, // 
    ".dockerignore":      {Icon: "\uf0868", Color: 68}, // 󰡨
    ".ds_store":          {Icon: "\ue615", Color: 239}, // 
    ".editorconfig":      {Icon: "\ue652", Color: 255}, // 
    ".env":               {Icon: "\uf462", Color: 227}, // 
    ".eslintrc":          {Icon: "\ue655", Color: 56}, // 
    ".eslintignore":      {Icon: "\ue655", Color: 56}, // 
    ".gitlab-ci.yml":     {Icon: "\uf296", Color: 196}, // 
    ".gtkrc-2.0":         {Icon: "\uf362", Color: 231}, // 
    ".gvimrc":            {Icon: "\ue62b", Color: 28}, // 
    ".luaurc":            {Icon: "\ue615", Color: 75}, // 
    ".npmignore":         {Icon: "\ue71e", Color: 197}, // 
    ".settings.json":     {Icon: "\ue70c", Color: 98}, // 
    ".zprofile":          {Icon: "\ue615", Color: 113}, // 
    ".zshenv":            {Icon: "\ue615", Color: 113}, // 
    "_gvimrc":            {Icon: "\ue62b", Color: 28}, // 
    "_vimrc":             {Icon: "\ue62b", Color: 28}, // 
    "R":                  {Icon: "\uf07d4", Color: 25}, // 󰟔
    "brewfile":           {Icon: "\ue791", Color: 52}, // 
    "bspwmrc":            {Icon: "\uf355", Color: 236}, // 
    "build":              {Icon: "\ue63a", Color: 113}, // 
    "checkhealth":        {Icon: "\uf04d9", Color: 75}, // 󰓙
    "cmakelists.txt":     {Icon: "\ue615", Color: 66}, // 
    "commit_editmsg":     {Icon: "\ue702", Color: 239}, // 
    "containerfile":      {Icon: "\uf0868", Color: 68}, // 󰡨
    "copying":            {Icon: "\ue60a", Color: 185}, // 
    "copying.lesser":     {Icon: "\ue60a", Color: 185}, // 
    "dockerfile":         {Icon: "\uf0868", Color: 68}, // 󰡨
    "gemfile$":           {Icon: "\ue791", Color: 52}, // 
    "gnumakefile":        {Icon: "\ue779", Color: 66}, // 
    "gradlew":            {Icon: "\ue660", Color: 24}, // 
    "gradle.properties":  {Icon: "\ue660", Color: 24}, // 
    "gradle-wrapper.properties":      {Icon: "\ue660", Color: 24}, // 
    "gruntfile":          {Icon: "\ue611", Color: 166}, // 
    "gulpfile":           {Icon: "\ue610", Color: 167}, // 
    "hyprland.conf":      {Icon: "\uf359", Color: 37}, // 
    "i3blocks.conf":      {Icon: "\uf35a", Color: 255}, // 
    "i3status.conf":      {Icon: "\uf35a", Color: 255}, // 
    "cantorrc":           {Icon: "\uf373", Color: 32}, // 
    "kalgebrarc":         {Icon: "\uf373", Color: 32}, // 
    "kdeglobals":         {Icon: "\uf373", Color: 32}, // 
    "kdenlive-layoutsrc": {Icon: "\uf33c", Color: 110}, // 
    "kdenliverc":         {Icon: "\uf33c", Color: 110}, // 
    "kritadisplayrc":     {Icon: "\uf33d", Color: 201}, // 
    "kritarc":            {Icon: "\uf33d", Color: 201}, // 
    "lxde-rc.xml":        {Icon: "\uf363", Color: 246}, // 
    "lxqt.conf":          {Icon: "\uf364", Color: 32}, // 
    "mix.lock":           {Icon: "\ue62d", Color: 140}, // 
    "mpv.conf":           {Icon: "\uf36e", Color: 53}, // 
    "package.json":       {Icon: "\ue71e", Color: 197}, // 
    "package-lock.json":  {Icon: "\ue71e", Color: 52}, // 
    "platformio.ini":     {Icon: "\ue682", Color: 208}, // 
    "pom.xml":            {Icon: "\ue674", Color: 52}, // 
    "PrusaSlicer.ini":    {Icon: "\uf351", Color: 202}, // 
    "PrusaSlicerGcodeViewer.ini":       {Icon: "\uf351", Color: 202}, // 
    "py.typed":           {Icon: "\ue606", Color: 214}, // 
    "QtProject.conf":     {Icon: "\uf375", Color: 77}, // 
    "svelte.config.js":   {Icon: "\ue697", Color: 196}, // 
    "sxhkdrc":            {Icon: "\uf355", Color: 236}, // 
    "tailwind.config.js": {Icon: "\uf13ff", Color: 45}, // 󱏿
    "tailwind.config.mjs":{Icon: "\uf13ff", Color: 45}, // 󱏿
    "tailwind.config.ts": {Icon: "\uf13ff", Color: 45}, // 󱏿
    "tsconfig.json":      {Icon: "\ue69d", Color: 74}, // 
    "unlicense":          {Icon: "\ue60a", Color: 185}, // 
    "vagrantfile$":       {Icon: "\uf2b8", Color: 27}, // 
    "vlcrc":              {Icon: "\uf057c", Color: 208}, // 󰕼
    "webpack":            {Icon: "\uf072b", Color: 74}, // 󰜫
    "weston.ini":         {Icon: "\uf367", Color: 214}, // 
    "workspace":          {Icon: "\ue63a", Color: 113}, // 
    "xmobarrc":           {Icon: "\uf35e", Color: 203}, // 
    "xmobarrc.hs":        {Icon: "\uf35e", Color: 203}, // 
    "xmonad.hs":          {Icon: "\uf35e", Color: 203}, // 
    "build.zig.zon":      {Icon: "\ue6a9", Color: 172}, // 

    ".cbl":            {Icon: "\u2699", Color: 25},     // ⚙
    ".ccm":            {Icon: "\ue61d", Color: 204},     // 
    ".cjs":            {Icon: "\ue60c", Color: 185},     // 
    ".cljc":           {Icon: "\ue768", Color: 113},     // 
    ".cljd":           {Icon: "\ue76a", Color: 74},     // 
    ".cmake":          {Icon: "\ue615", Color: 66},     // 
    ".cob":            {Icon: "\u2699", Color: 25},     // ⚙
    ".cobol":          {Icon: "\u2699", Color: 25},     // ⚙
    ".config.ru":      {Icon: "\ue791", Color: 52},     // 
    ".cppm":           {Icon: "\ue61d", Color: 74},     // 
    ".cpy":            {Icon: "\u2699", Color: 25},     // ⚙
    ".cr":             {Icon: "\ue62f", Color: 251},     // 
    ".cson":           {Icon: "\ue60b", Color: 185},     // 
    ".cts":            {Icon: "\ue628", Color: 74},     // 
    ".cu":             {Icon: "\ue64b", Color: 113},     // 
    ".cuh":            {Icon: "\ue64b", Color: 140},     // 
    ".cxxm":           {Icon: "\ue61d", Color: 74},     // 
    ".drl":            {Icon: "\ue28c", Color: 217},     // 
    ".dropbox":        {Icon: "\ue707", Color: 27},     // 
    ".edn":            {Icon: "\ue76a", Color: 74},     // 
    ".eex":            {Icon: "\ue62d", Color: 140},     // 
    ".epp":            {Icon: "\ue631", Color: 214},     // 
    ".f#":             {Icon: "\ue7a7", Color: 74},     // 
    ".f3d":            {Icon: "\uf0eeb", Color: 101},     // 󰻫
    ".fsscript":       {Icon: "\ue7a7", Color: 74},     // 
    ".glb":            {Icon: "\uf1b2", Color: 214},     // 
    ".gnumakefile":    {Icon: "\ue779", Color: 66},     // 
    ".haml":           {Icon: "\ue60e", Color: 255},     // 
    ".hx":             {Icon: "\ue666", Color: 208},     // 
    ".heex":           {Icon: "\ue62d", Color: 140},     // 
    ".hrl":            {Icon: "\ue7b1", Color: 163},     // 
    ".huff":           {Icon: "\uf0858", Color: 56},     // 󰡘
    ".hurl":           {Icon: "\uf0ec", Color: 198},     // 
    ".ixx":            {Icon: "\ue61d", Color: 74},     // 
    ".import":         {Icon: "\uf0c6", Color: 255},     // 
    ".jwmrc":          {Icon: "\uf35b", Color: 32},     // 
    ".json5":          {Icon: "\ue60b", Color: 185},     // 
    ".jsonc":          {Icon: "\ue60b", Color: 185},     // 
    ".leex":           {Icon: "\ue62d", Color: 140},     // 
    ".lff":            {Icon: "\uf031", Color: 255},     // 
    ".liquid":         {Icon: "\ue670", Color: 106},     // 
    ".material":       {Icon: "\uf0509", Color: 163},     // 󰔉
    ".mint":           {Icon: "\uf032a", Color: 108},     // 󰌪
    ".ml":             {Icon: "\ue67a", Color: 166},     // 
    ".mli":            {Icon: "\ue67a", Color: 166},     // 
    ".mo":             {Icon: "\u221e", Color: 135},     // ∞
    ".mpp":            {Icon: "\ue61d", Color: 74},     // 
    ".msf":            {Icon: "\uf370", Color: 33},     // 
    ".mts":            {Icon: "\ue628", Color: 74},     // 
    ".nim":            {Icon: "\ue677", Color: 220},     // 
    ".nswag":          {Icon: "\ue60b", Color: 112},     // 
    ".nu":             {Icon: "\u003e", Color: 36},     // >
    ".pck":            {Icon: "\uf487", Color: 66},     // 
    ".pm":             {Icon: "\ue769", Color: 74},     // 
    ".pp":             {Icon: "\ue631", Color: 214},     // 
    ".prisma":         {Icon: "\ue684", Color: 62},     // 
    ".pro":            {Icon: "\ue7a1", Color: 179},     // 
    ".psd1":           {Icon: "\uf0a0a", Color: 68},     // 󰨊
    ".psm1":           {Icon: "\uf0a0a", Color: 68},     // 󰨊
    ".psb":            {Icon: "\ue7b8", Color: 74},     // 
    ".pxd":            {Icon: "\ue606", Color: 39},     // 
    ".pxi":            {Icon: "\ue606", Color: 39},     // 
    ".pyd":            {Icon: "\ue606", Color: 222},     // 
    ".pyi":            {Icon: "\ue606", Color: 214},     // 
    ".pyo":            {Icon: "\ue606", Color: 222},     // 
    ".pyx":            {Icon: "\ue606", Color: 39},     // 
    ".query":          {Icon: "\ue21c", Color: 107},     // 
    ".rake":           {Icon: "\ue791", Color: 52},     // 
    ".res":            {Icon: "\ue688", Color: 167},     // 
    ".resi":           {Icon: "\ue688", Color: 204},     // 
    ".rproj":          {Icon: "\uf05c6", Color: 29},     // 󰗆
    ".sbt":            {Icon: "\ue737", Color: 167},     // 
    ".sc":             {Icon: "\ue737", Color: 167},     // 
    ".scm":            {Icon: "\uf0627", Color: 255},     // 󰘧
    ".sig":            {Icon: "\u03bb", Color: 166},     // λ
    ".sml":            {Icon: "\u03bb", Color: 166},     // λ
    ".sol":            {Icon: "\ue656", Color: 74},     // 
    ".spec.js":        {Icon: "\uf499", Color: 185},     // 
    ".spec.jsx":       {Icon: "\uf499", Color: 45},     // 
    ".spec.ts":        {Icon: "\uf499", Color: 74},     // 
    ".spec.tsx":       {Icon: "\uf499", Color: 26},     // 
    ".strings":        {Icon: "\uf1ab", Color: 31},     // 
    ".sublime":        {Icon: "\ue7aa", Color: 166},     // 
    ".suo":            {Icon: "\ue70c", Color: 98},     // 
    ".t":              {Icon: "\ue769", Color: 74},     // 
    ".tbc":            {Icon: "\uf06d3", Color: 25},     // 󰛓
    ".tcl":            {Icon: "\uf06d3", Color: 25},     // 󰛓
    ".templ":          {Icon: "\ueac4", Color: 178},     // 
    ".terminal":       {Icon: "\uf489", Color: 34},     // 
    ".test.js":        {Icon: "\uf499", Color: 185},     // 
    ".test.jsx":       {Icon: "\uf499", Color: 45},     // 
    ".test.ts":        {Icon: "\uf499", Color: 74},     // 
    ".test.tsx":       {Icon: "\uf499", Color: 26},     // 
    ".tf":             {Icon: "\ue69a", Color: 93},     // 
    ".tfvars":         {Icon: "\uf15b", Color: 93},     // 
    ".vala":           {Icon: "\ue69e", Color: 91},     // 
    ".vsh":            {Icon: "\ue6ac", Color: 67},     // 
    ".wasm":           {Icon: "\ue6a1", Color: 62},     // 
    ".webmanifest":    {Icon: "\ue60b", Color: 185},     // 
    ".webpack":        {Icon: "\uf072b", Color: 74},     // 󰜫
    ".x":              {Icon: "\ue691", Color: 111},     // 
    ".xm":             {Icon: "\ue691", Color: 74},     // 
    ".xaml":           {Icon: "\uf0673", Color: 56},     // 󰙳
    ".xcplayground":   {Icon: "\ue755", Color: 166},     // 
    ".xcstrings":      {Icon: "\uf1ab", Color: 31},     // 

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.

Extend Nerd Fonts icon coverage on more remotes and file extensions
2 participants