Skip to content

Instantly share code, notes, and snippets.

@ddrscott
Last active June 9, 2017 21:04
Show Gist options
  • Save ddrscott/dcdaf1a3f04d2d299d972ee2199097d6 to your computer and use it in GitHub Desktop.
Save ddrscott/dcdaf1a3f04d2d299d972ee2199097d6 to your computer and use it in GitHub Desktop.
Random 10th `e` opens unicorns in browser in the background
#!/bin/zsh
heart(){
zle self-insert
if [ $((RANDOM % 10)) -eq 0 ]; then
(head -$((${RANDOM} % $(wc -l < /usr/share/dict/words) + 1)) /usr/share/dict/words | tail -1 | sed -E -e "s~(.*)~https://google.com/search?tbm=isch\&q=\1~" | xargs open -g &)
fi
}
zle -N heart
bindkey 'e' heart
@ddrscott
Copy link
Author

ddrscott commented May 18, 2017

curl -L http://bit.ly/bindkeyee >> ~/.zshrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment