gmocli is a command-line interface for emoji selection with gitmoji support
Some time ago, I got myself into the habit of using gitmoji in my commit messages in my personal projects. 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 gmocli 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 Gmocli
Arch Linux users can install the AUR package.
paru -S gmocli
# or
yay -S gmocli
Users with rustup installed can install the crate using cargo.
cargo install gmocli
Usage
Usage: gmocli [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)
gmocli -li
search for an emoji using keywords
gmocli -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
gmocli -n 'guide dog'
# output
🦮
use in a commit message
git commit -m "$(gmocli -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
gmocli -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 gmocli -li is the wezterm terminal with the Noto Color Emoji font installed and configured. Kitty also works well.
Update December 2023: the project was renamed from "emocli" to "gmocli" after I learned that another project named "emocli" was created not long before this one.
~ Doug