my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
5.6 KiB

3 years ago
  1. # emoji plugin
  2. Support for conveniently working with Unicode emoji in Zsh.
  3. ## Features
  4. This plugin provides support for working with Unicode emoji characters in `zsh` using human-readable identifiers. It provides global variables which map emoji names to the actual characters, country names to their flags, and some named groupings of emoji. It also provides associated functions for displaying them.
  5. #### Variables
  6. Variable | Description
  7. ----------------- | --------------------------------
  8. $emoji | Maps emoji names to characters (except flags)
  9. $emoji_flags | Maps country names to flag characters (using region indicators)
  10. $emoji_groups | Named groups of emoji. Keys are group names; values are whitespace-separated lists of character names
  11. You may define new emoji groups at run time by modifying `$emoji_groups`. The special group name `all` is reserved for use by the plugin. You should not modify `$emoji` or `$emoji_flags`.
  12. #### Functions
  13. Function | Description
  14. ---------------- | -------------------------------
  15. random_emoji | Prints a random emoji character
  16. display_emoji | Displays emoji, along with their names
  17. ## Usage and Examples
  18. To output a specific emoji, use:
  19. ```
  20. $> echo $emoji[<name>]
  21. ```
  22. E.g.:
  23. ```
  24. $> echo $emoji[mouse_face]
  25. ```
  26. To output a random emoji, use:
  27. ```
  28. $> random_emoji
  29. ```
  30. To output a random emoji from a particular group, use:
  31. ```
  32. $> random_emoji <group>
  33. ```
  34. E.g.:
  35. ```
  36. $> random_emoji fruits
  37. $> random_emoji animals
  38. $> random_emoji vehicles
  39. $> random_emoji faces
  40. ```
  41. The defined group names can be found with `echo ${(k)emoji_groups}`.
  42. To list all available emoji with their names, use:
  43. ```
  44. $> display_emoji
  45. $> display_emoji faces
  46. $> display_emoji people
  47. ```
  48. To use emoji in a prompt:
  49. ```
  50. PROMPT="$emoji[penguin] > ""
  51. PROMPT='$(random_emoji fruits) > '
  52. surfer=$emoji[surfer]
  53. PROMPT="$surfer > "
  54. ```
  55. ## Technical Details
  56. The emoji names and codes are sourced from Unicode Technical Report \#51, which provides information on emoji support in Unicode. It can be found at https://www.unicode.org/reports/tr51/index.html.
  57. The group definitions are added by this OMZ plugin. They are not based on external definitions.
  58. The values in the `$emoji*` maps are the emoji characters themselves, not escape sequences or other forms that require interpretation. They can be used in any context and do not require escape sequence support from commands like `echo` or `print`.
  59. The emoji in the main `$emoji` map are standalone character sequences which can all be output on their own, without worrying about combining characters. The values may actually be multi-code-point sequences, instead of a single code point, and may include combining characters in those sequences. But they're arranged so their effects do not extend beyond that sequence.
  60. The exception to this is the skin tone / hair style variation selectors. These are included in the main `$emoji` map because they can be displayed on their own, as well as used as combining characters. (If they follow a character that is not one of the emoji characters they combine with, they are displayed as color swatches.)
  61. ## Experimental Features
  62. This defines some additional variables and functions, but these are experimental and subject to change at any time. You shouldn't rely on them being available. They're mostly for the use of emoji plugin developers to help decide what to include in future revisions.
  63. Variables:
  64. Variable | Description
  65. ----------------- | --------------------------------
  66. $emoji_skintone | Skin tone modifiers (from Unicode 8.0)
  67. #### Skin Tone Variation Selection
  68. This includes experimental support for the skin tone Variation Selectors introduced with Unicode 8.0, which let you select different skin tones for emoji involving humans.
  69. NOTE: This really is experimental. The skin tone selectors are a relatively new feature and may not be supported by all systems. And the support in this plugin is a work in progress. It may not work in all places. In fact, I haven't gotten it to work anywhere yet. -apjanke
  70. The "variation selectors" are combining characters which change the appearance of the preceding character. A variation selector character can be output immediately following a human emoji to change its skin tone color. You can also output a variation selector on its own to display a color swatch of that skin tone.
  71. The `$emoji_skintone` associative array maps skin tone IDs to the variation selector characters. To use one, output it immediately following a smiley or other human emoji.
  72. ```
  73. echo $emoji[waving_hand]$emoji_skintone[5]
  74. ```
  75. Note that `$emoji_skintone` is an associative array, and its keys are the *names* of "Fitzpatrick Skin Type" groups, not linear indexes into a normal array. The names are `1_2`, `3`, `4`, `5`, and `6`. (Types 1 and 2 are combined into a single color.) See the [Diversity section in Unicode TR 51](https://www.unicode.org/reports/tr51/index.html#Diversity) for details.
  76. #### Gemoji support
  77. The [gemoji project](https://github.com/github/gemoji) seems to be the de facto main source for short names and other emoji-related metadata that isn't included in the official Unicode reports. So, our list of emojis incorporates some of their aliases to make your life more convenient:
  78. ```
  79. echo $emoji[grinning_face_with_smiling_eyes]
  80. echo $emoji[smile]
  81. ```
  82. These two commands yield the same emoji (😄). The first name is the official one, in the Unicode reference, and the second one is the alias that was in Gemoji's database.
  83. ## TODO
  84. These are things that could be enhanced in future revisions of the plugin.
  85. * Incorporate CLDR data for ordering and groupings
  86. * Short :bracket: style names (from gemoji)
  87. * ZWJ combining function?