Skip to content

Instantly share code, notes, and snippets.

@juergenhoetzel
Created September 19, 2017 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juergenhoetzel/83aa567601bbb8339366d265b5470364 to your computer and use it in GitHub Desktop.
Save juergenhoetzel/83aa567601bbb8339366d265b5470364 to your computer and use it in GitHub Desktop.
Emojify bash completion: https://github.com/mrowa44/emojify
# emojify completion -*- shell-script -*-
_emojify_complte(){
local cur
_get_comp_words_by_ref -n : cur
COMPREPLY=( $(compgen -W "${_emojis[*]}" -- ${cur}) )
__ltrim_colon_completions "$cur"
}
# sanity checks
if ! command -v _get_comp_words_by_ref >/dev/null; then
echo "Bash completion not installed" >&2
elif ! command -v emojify >/dev/null; then
echo "Emoijify not installed" >&2
else
# get list of emojis
mapfile -t _emojis < <(emojify --list|grep ^:|cut -d \ -f 1)
complete -F _emojify_complte emojify
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment