I've recently gotten into the habit of using gitmoji in my commit messages, and I've decided that I really like having visual cues in my commit logs. I think the added visual image helps with quickly associating each commit with the type of work that was done. Now that I'm hooked on this practice, my brain really doesn't want me to go back.
While there is gitmoji-cli, there are times when I just want to use another emoji that has not been incorporated into the gitmoji project. For example, I may use a cookie (๐ช) when writing a commit message related to work on HTTP cookies, or a vomiting face (๐คฎ) for a commit which adds a lot of debug statements.
For these other emoji characters, one would typically need to turn to a helper application like the KDE Emoji Picker, the Gnome Emoji Selector, or a web browser with Emojipedia. There are also extensions for the rofi utility (rofi-emoji and rofimoji) which allow a lightweight solution for those not in full desktop environments.
I created emocli to provide a command-line interface for searching and selecting emoji characters from a combined dataset that uses information from Unicode, Inc. and also the gitmoji project.
How to Install Emocli
Arch Linux users can install the AUR package.
paru -S emocli
# or
yay -S emocli
Users with rustup installed can install the crate using cargo.
cargo install emocli
Usage
Usage: emocli [OPTIONS] <search>
OPTIONS:
-h | --help print this help
-l | --list list all emoji characters
-i | --info include info
-n | --name match name exactly
Examples
list all emoji characters with their name, categories, keywords, and gitmoji description (if available)
emocli -li
search for an emoji using keywords
emocli -i dog
# output
๐ถ dog face | Animals & Nature / animal-mammal | dog,face,pet
๐ dog | Animals & Nature / animal-mammal | dog,pet
๐ฆฎ guide dog | Animals & Nature / animal-mammal | accessibility,blind,guide,guide dog
๐โ๐ฆบ service dog | Animals & Nature / animal-mammal | accessibility,assistance,dog,service
๐ฉ poodle | Animals & Nature / animal-mammal | dog,poodle
๐ญ hot dog | Food & Drink / food-prepared | frankfurter,hot dog,hotdog,sausage
print a specific emoji by name
if the name is more than one word, it should be enclosed in quotes
emocli -n 'guide dog'
# output
๐ฆฎ
use in a commit message
git commit -m "$(emocli -n rocket) production launch"
use with rofi and xclip
The following script provides similar functionality to the rofi extensions mentioned above (using rofi and xclip).
# put this somewhere as a script in your PATH, shell alias, or keyboard shortcut
emocli -li | rofi -dmenu -window-title emoji | cut -d' ' -f1 | tr -d '\n' | xclip -selection clipboard
Troubleshooting
my terminal is not displaying all emoji characters
Your mileage may vary on terminal support for displaying emoji consisting of 2 or more characters joined by a zero-width joiner character (U+200D). The "service dog" emoji (๐โ๐ฆบ) is one such example. Even with a proper font config, it will appear on many terminals as a dog next to a safety vest.
๐๐ฆบ
Currently, the best configuration tested with emocli -li
is the wezterm terminal with the Noto Color Emoji font installed and configured.
Top comments (1)
For the 2-3 people interested, I've rewritten this in Rust and deprecated the NPM package. This article has been updated.