1 # AX-ZSH: Alex' Modular ZSH Configuration
2 # cheat: Setup https://cht.sh
4 if (( $+commands[fzf] )); then
5 # See <https://twitter.com/igor_chubin/status/1343294742315020293>
8 term=$(curl -ks "$url/:list" | IFS=+ fzf --preview "curl -ks '$url/{}'" -q "$*") \
9 && curl -ks "$url/${term}" | ${PAGER:-less}
13 # Don't overwrite a real "cheat" command!
14 (( $+commands[cheat] )) && return
17 if (( $+commands[cht.sh] )); then
18 if [[ $# -eq 0 ]]; then
19 CHTSH_QUERY_OPTIONS="style=monokai" cht.sh --shell
21 CHTSH_QUERY_OPTIONS="style=monokai" cht.sh "$@" \
27 url="https://cht.sh/$@?style=monokai"
29 if (( $+commands[curl] )); then
30 curl -s "$url" | ${PAGER:-less}
31 elif (( $+commands[wget] )); then
32 wget -qO - "$url" | ${PAGER:-less}
34 echo "Neither cht.sh(1), curl(1) nor wget(1) found!" >&2