Skip to content

Instantly share code, notes, and snippets.

@GeneralD
Last active March 15, 2025 16:29
Show Gist options
  • Save GeneralD/5fb6eee1bf99a6c2e1360305ec216af0 to your computer and use it in GitHub Desktop.
Save GeneralD/5fb6eee1bf99a6c2e1360305ec216af0 to your computer and use it in GitHub Desktop.
function skim-gitignore() {
local api="https://www.toptal.com/developers/gitignore/api"
local gi=$(curl -sfL $api/list | tr "," "\n" | sk --query="$1" -m --preview "curl -sfLw '\n' $api/{} | bat --style=numbers --color=always --language='Git Ignore'")
if [[ $gi ]]; then
for prog in $(echo $gi); do;
curl -sfLw '\n' "$api/$prog" >> .gitignore;
echo "Added $prog to .gitignore";
done;
fi
zle reset-prompt;
}
zle -N skim-gitignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment