-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
base: master
Are you sure you want to change the base?
Conversation
8bda844
to
72e7428
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, great work
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 #!/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 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
|
Initially I opened #3426 issue, this PR is targeted to fix that.
go generate ./...
)docs/Config.md
) have been updated if necessaryThis 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.Would be nice if in the future the user can make overrides via config file.
Fix #3426