This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
keybind_as_widget() { | |
local hash=$(echo $2 | md5) | |
local widget_name="__widget_$hash" | |
eval "function $widget_name() { $2; }" | |
zle -N $widget_name | |
bindkey $1 $widget_name | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# helper functions for https://github.com/Aloxaf/gencomp | |
clean-gencomp() { | |
for file in $GENCOMP_DIR/*; do | |
local cmd=$(basename $file | sed 's/^_//') | |
command -v $cmd &>/dev/null && continue | |
echo "Remove completion for $cmd? [y/N]" | |
read -q |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function skim-nerdfont() { | |
(( $+commands[ascii2uni] )) || { echo "ascii2uni is not installed"; return 1; } | |
(( $+commands[rg] )) || { echo "rg is not installed"; return 1; } | |
local list=$(curl -s https://www.nerdfonts.com/cheat-sheet | rg '^ *\"(.+)\"\: ?\"([a-f0-9]{4})\",?$' --color=never --replace '\u$2 $1' | ascii2uni -a U -q) | |
local select=$(echo $list | sk --query="$1" --multi) | |
echo $select | awk '{print $1}' | tr '\n' ' ' | pbcopy | |
zle reset-prompt; | |
} |
OlderNewer