Add GitHub emoji codes to OS X's symbol and text substitution.
This project contains a plist that is suitable to import into OS X's text substitution pref pane and the code used to generate it.
- (optional) Back up your existing custom text substitution rules:
/usr/libexec/PlistBuddy -x -c "Print NSUserReplacementItems" ~/Library/Preferences/.GlobalPreferences.plist > backup.plist
- Initialize NSUserReplacements:
- Go to System Preferences > Language & Text > Text
- Click the "Restore Defaults" button
- Make sure "Use symbol and text substitution" is checked
- Download and install the GitHub emoji expansion plist
curl -O https://raw.github.com/gregburek/github-emoji-expansion-in-osx/master/NSUserReplacementItems.plist
/usr/libexec/PlistBuddy -c "Merge '`pwd`/NSUserReplacementItems.plist' NSUserReplacementItems" ~/Library/Preferences/.GlobalPreferences.plist
- (optional) Restore your previous custom text substitution rules:
/usr/libexec/PlistBuddy -c "Merge '`pwd`/backup.plist' NSUserReplacementItems" ~/Library/Preferences/.GlobalPreferences.plist
- (optional) Enable text replacement in all apps by default:
defaults write -g WebAutomaticTextReplacementEnabled -bool true
The generation script has been tested on Ruby versions 1.9.2-p290 and 1.9.3-p327 and I recommend developing the project in a similar environment as unicode support in 1.8 is not best.
Install dependencies locally by running bundle install
. To regenerate the NSUserReplacementItems.plist
file, run bundle exec ruby generate_plist.rb
- Emoji listed below are not included in this plist and ignored by the generation script. Some rely on multi-part unicode like Regional Indicator Symbols, and supporting them would require a minor refactor. Others are just special 😄
- Emoji present in Github but not in unicode:
- 🖕
- 🤘
- :squirrel:
- Unicode not currently supported by this script:
- 🇨🇳 - 1f1e8-1f1f3
- 🇩🇪 - 1f1e9-1f1ea
- 🇪🇸 - 1f1ea-1f1f8
- 🇫🇷 - 1f1eb-1f1f7
- 🇬🇧 - 1f1ec-1f1e7
- 🇮🇹 - 1f1ee-1f1f9
- 🇯🇵 - 1f1ef-1f1f5
- 🇰🇷 - 1f1f0-1f1f7
- 🇷🇺 - 1f1f7-1f1fa
- 🇬🇧 - 1f1ec-1f1e7
- 🇺🇸 - 1f1fa-1f1f8
- Ben Alman's dotfiles repo provided significant inspiration for how to merge in the generated NSReplacement.plist file.