0613232202b92349cee79804fc46e0495152ef12
- Author
- Léopold Mebazaa <lemeb@users.noreply.github.com>
- Committer
- Marc Cornellà <hello@mcornella.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/emoji/README.md b/plugins/emoji/README.md
2index 8b8860a86bdd2881a6ea90cb4731d8bbe678d701..4154ea0dc4218b41af2368005d4ae8e2d4bc9bff 100644
3--- a/plugins/emoji/README.md
4+++ b/plugins/emoji/README.md
5@@ -10,7 +10,7 @@ This plugin provides support for working with Unicode emoji characters in `zsh`
6
7 Variable | Description
8 ----------------- | --------------------------------
9- $emoji | Maps emoji names to characters
10+ $emoji | Maps emoji names to characters (except flags)
11 $emoji_flags | Maps country names to flag characters (using region indicators)
12 $emoji_groups | Named groups of emoji. Keys are group names; values are whitespace-separated lists of character names
13
14@@ -55,10 +55,8 @@ The defined group names can be found with `echo ${(k)emoji_groups}`.
15 To list all available emoji with their names, use:
16 ```
17 $> display_emoji
18-$> display_emoji fruits
19-$> display_emoji animals
20-$> display_emoji vehicles
21 $> display_emoji faces
22+$> display_emoji people
23 ```
24
25 To use emoji in a prompt:
26@@ -73,13 +71,13 @@ PROMPT="$surfer > "
27
28 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.
29
30-The group definitions are added by this OMZ plugin. They are not based on external definitions. (As far as I can tell. -apjanke)
31+The group definitions are added by this OMZ plugin. They are not based on external definitions.
32
33 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`.
34
35diff --git a/plugins/emoji/emoji-char-definitions.zsh b/plugins/emoji/emoji-char-definitions.zsh
36index 04693da0593b98620161e2d52aaeba3115d953c9..b37c142a1a5cd40231d684c192d8de786ab268d7 100644
37--- a/plugins/emoji/emoji-char-definitions.zsh
38+++ b/plugins/emoji/emoji-char-definitions.zsh
39@@ -1,11 +1,18 @@
40
41-# emoji-char-definitions.zsh - Emoji character definitions for oh-my-zsh emoji plugin
42+# emoji-char-definitions.zsh - Emoji definitions for oh-my-zsh emoji plugin
43 #
44-# This file is auto-generated by update_emoji.pl. Do not edit it manually.
45+# This file is auto-generated by update_emoji.py. Do not edit it manually.
46 #
47 # This contains the definition for:
48 # $emoji - which maps character names to Unicode characters
49-# $emoji_flags - maps country names to Unicode flag characters using region indicators
50+# $emoji_flags - maps country names to Unicode flag characters using region
51+# indicators
52+# $emoji_mod - maps modifier components to Unicode characters
53+# $emoji_groups - a single associative array to avoid cluttering up the
54+# global namespace, and to allow adding additional group
55+# definitions at run time. The keys are the group names, and
56+# the values are whitespace-separated lists of emoji
57+# character names.
58
59 # Main emoji
60 typeset -gAH emoji
61@@ -13,1291 +20,7255 @@ typeset -gAH emoji
62 typeset -gAH emoji_flags
63 # Combining modifiers
64 typeset -gAH emoji_mod
65-
66-emoji[copyright_sign]=$'\U00A9'
67-emoji[registered_sign]=$'\U00AE'
68-emoji[double_exclamation_mark]=$'\U203C'
69-emoji[exclamation_question_mark]=$'\U2049'
70-emoji[trade_mark_sign]=$'\U2122'
71-emoji[information_source]=$'\U2139'
72-emoji[left_right_arrow]=$'\U2194'
73-emoji[up_down_arrow]=$'\U2195'
74-emoji[north_west_arrow]=$'\U2196'
75-emoji[north_east_arrow]=$'\U2197'
76-emoji[south_east_arrow]=$'\U2198'
77-emoji[south_west_arrow]=$'\U2199'
78-emoji[leftwards_arrow_with_hook]=$'\U21A9'
79-emoji[rightwards_arrow_with_hook]=$'\U21AA'
80-emoji[watch]=$'\U231A'
81-emoji[hourglass]=$'\U231B'
82-emoji[keyboard]=$'\U2328'
83-emoji[eject_symbol]=$'\U23CF'
84-emoji[black_right_pointing_double_triangle]=$'\U23E9'
85-emoji[black_left_pointing_double_triangle]=$'\U23EA'
86-emoji[black_up_pointing_double_triangle]=$'\U23EB'
87-emoji[black_down_pointing_double_triangle]=$'\U23EC'
88-emoji[black_right_pointing_double_triangle_with_vertical_bar]=$'\U23ED'
89-emoji[black_left_pointing_double_triangle_with_vertical_bar]=$'\U23EE'
90-emoji[black_right_pointing_triangle_with_double_vertical_bar]=$'\U23EF'
91-emoji[alarm_clock]=$'\U23F0'
92-emoji[stopwatch]=$'\U23F1'
93-emoji[timer_clock]=$'\U23F2'
94-emoji[hourglass_with_flowing_sand]=$'\U23F3'
95-emoji[double_vertical_bar]=$'\U23F8'
96-emoji[black_square_for_stop]=$'\U23F9'
97-emoji[black_circle_for_record]=$'\U23FA'
98-emoji[circled_latin_capital_letter_m]=$'\U24C2'
99-emoji[black_small_square]=$'\U25AA'
100-emoji[white_small_square]=$'\U25AB'
101-emoji[black_right_pointing_triangle]=$'\U25B6'
102-emoji[black_left_pointing_triangle]=$'\U25C0'
103-emoji[white_medium_square]=$'\U25FB'
104-emoji[black_medium_square]=$'\U25FC'
105-emoji[white_medium_small_square]=$'\U25FD'
106-emoji[black_medium_small_square]=$'\U25FE'
107-emoji[black_sun_with_rays]=$'\U2600'
108-emoji[cloud]=$'\U2601'
109-emoji[umbrella]=$'\U2602'
110-emoji[snowman]=$'\U2603'
111-emoji[comet]=$'\U2604'
112-emoji[black_telephone]=$'\U260E'
113-emoji[ballot_box_with_check]=$'\U2611'
114-emoji[umbrella_with_rain_drops]=$'\U2614'
115-emoji[hot_beverage]=$'\U2615'
116-emoji[shamrock]=$'\U2618'
117-emoji[white_up_pointing_index]=$'\U261D'
118-emoji[skull_and_crossbones]=$'\U2620'
119-emoji[radioactive_sign]=$'\U2622'
120-emoji[biohazard_sign]=$'\U2623'
121-emoji[orthodox_cross]=$'\U2626'
122-emoji[star_and_crescent]=$'\U262A'
123-emoji[peace_symbol]=$'\U262E'
124-emoji[yin_yang]=$'\U262F'
125-emoji[wheel_of_dharma]=$'\U2638'
126-emoji[white_frowning_face]=$'\U2639'
127-emoji[white_smiling_face]=$'\U263A'
128-emoji[aries]=$'\U2648'
129-emoji[taurus]=$'\U2649'
130-emoji[gemini]=$'\U264A'
131-emoji[cancer]=$'\U264B'
132-emoji[leo]=$'\U264C'
133-emoji[virgo]=$'\U264D'
134-emoji[libra]=$'\U264E'
135-emoji[scorpius]=$'\U264F'
136-emoji[sagittarius]=$'\U2650'
137-emoji[capricorn]=$'\U2651'
138-emoji[aquarius]=$'\U2652'
139diff --git a/plugins/emoji/emoji-data.txt b/plugins/emoji/emoji-data.txt
140index 2d6d64e2b412bf8df0c947df2f37fc6d4abdf4db..59b7e92d7fd924126f1a65ec6f62027165d4acab 100644
141--- a/plugins/emoji/emoji-data.txt
142+++ b/plugins/emoji/emoji-data.txt
143@@ -1,1308 +1,4122 @@
144-# DRAFT emoji-data.txt
145-# For details about the format and other information, see /../../../reports/tr51/index.html#Data_Files.
146+# emoji-data.txt
147+# (Originally emoji-test.txt)
148+# (Retrieved from https://unicode.org/Public/emoji/12.0/emoji-test.txt)
149+
150+# Date: 2019-01-27, 15:43:01 GMT
151+# © 2019 Unicode®, Inc.
152+# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries.
153+# For terms of use, see http://www.unicode.org/terms_of_use.html
154 #
155-# Format: Code ; Default_Emoji_Style ; Emoji_Level ; Emoji_Modifier_Status ; Emoji_Sources # Comment
156+# Emoji Keyboard/Display Test Data for UTS #51
157+# Version: 12.0
158 #
159-# Field 1 — Default_Emoji_Style:
160-# text: default text presentation
161-# emoji: default emoji presentation
162-# Field 2 — Emoji_Level:
163-# L1: level 1 emoji
164-# L2: level 2 emoji
165-# NA: not applicable
166-# Field 3 — Emoji_Modifier_Status:
167-# modifier: an emoji modifier
168-# primary: a primary emoji modifier base
169-# secondary: a secondary emoji modifier base
170-# none: not applicable
171-# Field 4 — Emoji_Sources:
172-# one or more values from {z, a, j, w, x}
173-# see the key in https://www.unicode.org/draft/reports/tr51/tr51.html#Major_Sources
174-# NA: not applicable
175-# Comment — currently contains the version where the character was first encoded,
176-# followed by:
177-# - a character name in uppercase (for a single character),
178-# - a keycap name,
179-# - an associated flag, where is associated with value unicode region code
180+# For documentation and usage, see http://www.unicode.org/reports/tr51
181 #
182-00A9 ; text ; L1 ; none ; j # V1.1 (©) COPYRIGHT SIGN
183-00AE ; text ; L1 ; none ; j # V1.1 (®) REGISTERED SIGN
184-203C ; text ; L1 ; none ; a j # V1.1 (‼) DOUBLE EXCLAMATION MARK
185-2049 ; text ; L1 ; none ; a j # V3.0 (⁉) EXCLAMATION QUESTION MARK
186-2122 ; text ; L1 ; none ; j # V1.1 (™) TRADE MARK SIGN
187-2139 ; text ; L1 ; none ; j # V3.0 (ℹ) INFORMATION SOURCE
188-2194 ; text ; L1 ; none ; z j # V1.1 (↔) LEFT RIGHT ARROW
189-2195 ; text ; L1 ; none ; z j # V1.1 (↕) UP DOWN ARROW
190-2196 ; text ; L1 ; none ; j # V1.1 (↖) NORTH WEST ARROW
191-2197 ; text ; L1 ; none ; j # V1.1 (↗) NORTH EAST ARROW
192-2198 ; text ; L1 ; none ; j # V1.1 (↘) SOUTH EAST ARROW
193-2199 ; text ; L1 ; none ; j # V1.1 (↙) SOUTH WEST ARROW
194-21A9 ; text ; L1 ; none ; j # V1.1 (↩) LEFTWARDS ARROW WITH HOOK
195-21AA ; text ; L1 ; none ; j # V1.1 (↪) RIGHTWARDS ARROW WITH HOOK
196-231A ; emoji ; L1 ; none ; j # V1.1 (⌚) WATCH
197-231B ; emoji ; L1 ; none ; j # V1.1 (⌛) HOURGLASS
198-2328 ; text ; L2 ; none ; x # V1.1 (⌨) KEYBOARD
199-23CF ; text ; L2 ; none ; x # V4.0 (⏏) EJECT SYMBOL
200-23E9 ; emoji ; L1 ; none ; j w # V6.0 (⏩) BLACK RIGHT-POINTING DOUBLE TRIANGLE
201-23EA ; emoji ; L1 ; none ; j w # V6.0 (⏪) BLACK LEFT-POINTING DOUBLE TRIANGLE
202-23EB ; emoji ; L1 ; none ; j # V6.0 (⏫) BLACK UP-POINTING DOUBLE TRIANGLE
203-23EC ; emoji ; L1 ; none ; j # V6.0 (⏬) BLACK DOWN-POINTING DOUBLE TRIANGLE
204-23ED ; text ; L2 ; none ; w # V6.0 (⏭) BLACK RIGHT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR
205-23EE ; text ; L2 ; none ; w # V6.0 (⏮) BLACK LEFT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR
206-23EF ; text ; L2 ; none ; x # V6.0 (⏯) BLACK RIGHT-POINTING TRIANGLE WITH DOUBLE VERTICAL BAR
207-23F0 ; emoji ; L1 ; none ; j # V6.0 (⏰) ALARM CLOCK
208-23F1 ; text ; L2 ; none ; x # V6.0 (⏱) STOPWATCH
209-23F2 ; text ; L2 ; none ; x # V6.0 (⏲) TIMER CLOCK
210-23F3 ; emoji ; L1 ; none ; j w # V6.0 (⏳) HOURGLASS WITH FLOWING SAND
211-23F8 ; text ; L2 ; none ; w # V7.0 (⏸) DOUBLE VERTICAL BAR
212-23F9 ; text ; L2 ; none ; w # V7.0 (⏹) BLACK SQUARE FOR STOP
213-23FA ; text ; L2 ; none ; w # V7.0 (⏺) BLACK CIRCLE FOR RECORD
214-24C2 ; text ; L1 ; none ; j # V1.1 (Ⓜ) CIRCLED LATIN CAPITAL LETTER M
215-25AA ; text ; L1 ; none ; j w # V1.1 (▪) BLACK SMALL SQUARE
216-25AB ; text ; L1 ; none ; j # V1.1 (▫) WHITE SMALL SQUARE
217-25B6 ; text ; L1 ; none ; a j w # V1.1 (▶) BLACK RIGHT-POINTING TRIANGLE
218-25C0 ; text ; L1 ; none ; a j w # V1.1 (◀) BLACK LEFT-POINTING TRIANGLE
219-25FB ; text ; L1 ; none ; j # V3.2 (◻) WHITE MEDIUM SQUARE
220-25FC ; text ; L1 ; none ; j w # V3.2 (◼) BLACK MEDIUM SQUARE
221-25FD ; emoji ; L1 ; none ; j # V3.2 (◽) WHITE MEDIUM SMALL SQUARE
222-25FE ; emoji ; L1 ; none ; j w # V3.2 (◾) BLACK MEDIUM SMALL SQUARE
223-2600 ; text ; L1 ; none ; a j # V1.1 (☀) BLACK SUN WITH RAYS
224-2601 ; text ; L1 ; none ; a j w # V1.1 (☁) CLOUD
225-2602 ; text ; L2 ; none ; a # V1.1 (☂) UMBRELLA
226-2603 ; text ; L2 ; none ; a # V1.1 (☃) SNOWMAN
227-2604 ; text ; L2 ; none ; x # V1.1 (☄) COMET
228-260E ; text ; L1 ; none ; z a j # V1.1 (☎) BLACK TELEPHONE
229-2611 ; text ; L1 ; none ; j w # V1.1 (☑) BALLOT BOX WITH CHECK
230-2614 ; emoji ; L1 ; none ; a j # V4.0 (☔) UMBRELLA WITH RAIN DROPS
231-2615 ; emoji ; L1 ; none ; j # V4.0 (☕) HOT BEVERAGE
232-2618 ; text ; L2 ; none ; x # V4.1 (☘) SHAMROCK
233-261D ; text ; L1 ; secondary ; j w # V1.1 (☝) WHITE UP POINTING INDEX
234-2620 ; text ; L2 ; none ; x # V1.1 (☠) SKULL AND CROSSBONES
235-2622 ; text ; L2 ; none ; x # V1.1 (☢) RADIOACTIVE SIGN
236-2623 ; text ; L2 ; none ; x # V1.1 (☣) BIOHAZARD SIGN
237-2626 ; text ; L2 ; none ; x # V1.1 (☦) ORTHODOX CROSS
238-262A ; text ; L2 ; none ; w # V1.1 (☪) STAR AND CRESCENT
239-262E ; text ; L2 ; none ; x # V1.1 (☮) PEACE SYMBOL
240-262F ; text ; L2 ; none ; w # V1.1 (☯) YIN YANG
241-2638 ; text ; L2 ; none ; w # V1.1 (☸) WHEEL OF DHARMA
242-2639 ; text ; L2 ; secondary ; w # V1.1 (☹) WHITE FROWNING FACE
243diff --git a/plugins/emoji/emoji.plugin.zsh b/plugins/emoji/emoji.plugin.zsh
244index 876011957ac6cc823bb86f69855a2eca31317b6c..f9e476ebf88481773c9fbebe972abffa57d43623 100644
245--- a/plugins/emoji/emoji.plugin.zsh
246+++ b/plugins/emoji/emoji.plugin.zsh
247@@ -15,9 +15,6 @@ _omz_emoji_plugin_dir="${0:h}"
248
249 local LC_ALL=en_US.UTF-8
250
251-typeset -gAH emoji_groups
252-typeset -gAH emoji_con
253-typeset -gAH emoji2
254 typeset -gAH emoji_skintone
255
256 source "$_omz_emoji_plugin_dir/emoji-char-definitions.zsh"
257@@ -30,7 +27,6 @@ unset _omz_emoji_plugin_dir
258 # The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
259 # It's unclear whether this should be in the $emoji array, because those characters are all ones
260 # which can be displayed on their own.
261-#emoji[combining_enclosing_keycap]="\U20E3"
262
263 emoji[regional_indicator_symbol_letter_d_regional_indicator_symbol_letter_e]=$'\xF0\x9F\x87\xA9\xF0\x9F\x87\xAA'
264 emoji[regional_indicator_symbol_letter_g_regional_indicator_symbol_letter_b]=$'\xF0\x9F\x87\xAC\xF0\x9F\x87\xA7'
265@@ -43,209 +39,12 @@ emoji[regional_indicator_symbol_letter_i_regional_indicator_symbol_letter_t]=$'\
266 emoji[regional_indicator_symbol_letter_u_regional_indicator_symbol_letter_s]=$'\xF0\x9F\x87\xBA\xF0\x9F\x87\xB8'
267 emoji[regional_indicator_symbol_letter_r_regional_indicator_symbol_letter_u]=$'\xF0\x9F\x87\xB7\xF0\x9F\x87\xBA'
268
269-# Nonstandard alias names
270-emoji[vulcan_salute]=$'\U1F596'
271-
272-
273-# Emoji combining and auxiliary characters
274-
275-# "Variation Selectors" for controlling text vs emoji style presentation
276-# These apply to the immediately preceding character
277-emoji2[text_style]=$'\UFE0E'
278-emoji2[emoji_style]=$'\UFE0F'
279-# Joiner that indicates a single combined-form glyph (ligature) should be used
280-emoji2[zero_width_joiner]=$'\U200D'
281-# Skin tone modifiers
282-emoji2[emoji_modifier_fitzpatrick_type_1_2]=$'\U1F3FB'
283-emoji2[emoji_modifier_fitzpatrick_type_3]=$'\U1F3FC'
284-emoji2[emoji_modifier_fitzpatrick_type_4]=$'\U1F3FD'
285-emoji2[emoji_modifier_fitzpatrick_type_5]=$'\U1F3FE'
286-emoji2[emoji_modifier_fitzpatrick_type_6]=$'\U1F3FF'
287-# Various other combining characters. (Incomplete list; I selected ones that sound useful)
288-emoji2[combining_enclosing_circle]=$'\U20DD'
289-emoji2[combining_enclosing_square]=$'\U20DE'
290-emoji2[combining_enclosing_diamond]=$'\U20DF'
291-emoji2[combining_enclosing_circle_backslash]=$'\U20E0'
292-emoji2[combining_enclosing_screen]=$'\U20E2'
293-emoji2[combining_enclosing_keycap]=$'\U20E3'
294-emoji2[combining_enclosing_upward_pointing_triangle]=$'\U20E4'
295-
296 # Easier access to skin tone modifiers
297 emoji_skintone[1_2]=$'\U1F3FB'
298 emoji_skintone[3]=$'\U1F3FC'
299 emoji_skintone[4]=$'\U1F3FD'
300 emoji_skintone[5]=$'\U1F3FE'
301 emoji_skintone[6]=$'\U1F3FF'
302-
303-# Emoji groups
304-# These are stored in a single associative array, $emoji_groups, to avoid cluttering up the global
305-# namespace, and to allow adding additional group definitions at run time.
306-# The keys are the group names, and the values are whitespace-separated lists of emoji character names.
307-
308-emoji_groups[fruits]="
309- tomato
310- aubergine
311- grapes
312- melon
313- watermelon
314- tangerine
315- banana
316- pineapple
317- red_apple
318- green_apple
319- peach
320- cherries
321- strawberry
322- lemon
323- pear
324-"
325-
326-emoji_groups[vehicles]="
327- airplane
328- rocket
329- railway_car
330- high_speed_train
331- high_speed_train_with_bullet_nose
332- bus
333- ambulance
334- fire_engine
335- police_car
336- taxi
337- automobile
338- recreational_vehicle
339- delivery_truck
340- ship
341- speedboat
342- bicycle
343- helicopter
344- steam_locomotive
345- train
346- light_rail
347diff --git a/plugins/emoji/gemoji_db.json b/plugins/emoji/gemoji_db.json
348new file mode 100644
349index 0000000000000000000000000000000000000000..9227c26d16a0a616ab880f77c3c7fdb6e859add5
350--- /dev/null
351+++ b/plugins/emoji/gemoji_db.json
352@@ -0,0 +1,21538 @@
353+[
354+ {
355+ "emoji": "😀"
356+ , "description": "grinning face"
357+ , "category": "Smileys & Emotion"
358+ , "aliases": [
359+ "grinning"
360+ ]
361+ , "tags": [
362+ "smile"
363+ , "happy"
364+ ]
365+ , "unicode_version": "6.1"
366+ , "ios_version": "6.0"
367+ }
368+, {
369+ "emoji": "😃"
370+ , "description": "grinning face with big eyes"
371+ , "category": "Smileys & Emotion"
372+ , "aliases": [
373+ "smiley"
374+ ]
375+ , "tags": [
376+ "happy"
377+ , "joy"
378+ , "haha"
379+ ]
380+ , "unicode_version": "6.0"
381+ , "ios_version": "6.0"
382+ }
383+, {
384+ "emoji": "😄"
385+ , "description": "grinning face with smiling eyes"
386+ , "category": "Smileys & Emotion"
387+ , "aliases": [
388+ "smile"
389+ ]
390+ , "tags": [
391+ "happy"
392+ , "joy"
393+ , "laugh"
394+ , "pleased"
395+ ]
396+ , "unicode_version": "6.0"
397+ , "ios_version": "6.0"
398+ }
399+, {
400+ "emoji": "😁"
401+ , "description": "beaming face with smiling eyes"
402+ , "category": "Smileys & Emotion"
403+ , "aliases": [
404+ "grin"
405+ ]
406+ , "tags": [
407+ ]
408+ , "unicode_version": "6.0"
409+ , "ios_version": "6.0"
410+ }
411+, {
412+ "emoji": "😆"
413+ , "description": "grinning squinting face"
414+ , "category": "Smileys & Emotion"
415+ , "aliases": [
416+ "laughing"
417+ , "satisfied"
418+ ]
419+ , "tags": [
420+ "happy"
421+ , "haha"
422+ ]
423+ , "unicode_version": "6.0"
424+ , "ios_version": "6.0"
425+ }
426+, {
427+ "emoji": "😅"
428+ , "description": "grinning face with sweat"
429+ , "category": "Smileys & Emotion"
430+ , "aliases": [
431+ "sweat_smile"
432+ ]
433+ , "tags": [
434+ "hot"
435+ ]
436+ , "unicode_version": "6.0"
437+ , "ios_version": "6.0"
438+ }
439+, {
440+ "emoji": "🤣"
441+ , "description": "rolling on the floor laughing"
442+ , "category": "Smileys & Emotion"
443+ , "aliases": [
444+ "rofl"
445+ ]
446+ , "tags": [
447+ "lol"
448+ , "laughing"
449+ ]
450+ , "unicode_version": "9.0"
451+ , "ios_version": "10.2"
452diff --git a/plugins/emoji/update_emoji.pl b/plugins/emoji/update_emoji.pl
453deleted file mode 100644
454index 8034052b7d314ecf0cf05cfecb008fce39dae480..0000000000000000000000000000000000000000
455--- a/plugins/emoji/update_emoji.pl
456+++ /dev/null
457@@ -1,113 +0,0 @@
458-#!/usr/bin/perl -w
459-#
460-# update_emoji.pl
461-#
462-# This script generates the emoji.plugin.zsh emoji definitions from the Unicode
463-# character data for the emoji characters.
464-#
465-# The data file can be found at https://unicode.org/Public/emoji/latest/emoji-data.txt
466-# as referenced in Unicode TR51 (https://www.unicode.org/reports/tr51/index.html).
467-#
468-# This is known to work with the data file from version 1.0. It may not work with later
469-# versions if the format changes. In particular, this reads line comments to get the
470-# emoji character name and unicode version.
471-#
472-# Country names have punctuation and other non-letter characters removed from their name,
473-# to avoid possible complications with having to escape the strings when using them as
474-# array subscripts. The definition file seems to use some combining characters like accents
475-# that get stripped during this process.
476-
477-use strict;
478-use warnings;
479-use 5.010;
480-use autodie;
481-
482-use Path::Class;
483-use File::Copy;
484-
485-# Parse definitions out of the data file and convert
486-sub process_emoji_data_file {
487- my ( $infile, $outfilename ) = @_;
488- my $file = file($infile);
489- my $outfile = file($outfilename);
490- my $outfilebase = $outfile->basename();
491- my $tempfilename = "$outfilename.tmp";
492- my $tempfile = file($tempfilename);
493- my $outfh = $tempfile->openw();
494- $outfh->print("
495-# $outfilebase - Emoji character definitions for oh-my-zsh emoji plugin
496-#
497-# This file is auto-generated by update_emoji.pl. Do not edit it manually.
498-#
499-# This contains the definition for:
500-# \$emoji - which maps character names to Unicode characters
501-# \$emoji_flags - maps country names to Unicode flag characters using region indicators
502-
503-# Main emoji
504-typeset -gAH emoji
505-# National flags
506-typeset -gAH emoji_flags
507-# Combining modifiers
508-typeset -gAH emoji_mod
509-
510-");
511-
512- my $fh = $file->openr();
513- my $line_num = 0;
514- while ( my $line = $fh->getline() ) {
515- $line_num++;
516- $_ = $line;
517- # Skip all-comment lines (from the header) and blank lines
518- # (But don't strip comments on normal lines; we need to parse those for
519- # the emoji names.)
520- next if /^\s*#/ or /^\s*$/;
521-
522- if (/^(\S.*?\S)\s*;\s*(\w+)\s*;\s*(\w+)\s*;\s*(\w+)\s*;\s*(\w.*?)\s*#\s*V(\S+)\s\(.*?\)\s*(\w.*\S)\s*$/) {
523- my ($code, $style, $level, $modifier_status, $sources, $version, $keycap_name)
524- = ($1, $2, $3, $4, $5, $6, $7);
525- #print "code=$code style=$style level=$level modifier_status=$modifier_status sources=$sources version=$version name=$keycap_name\n";
526- my @code_points = split /\s+/, $code;
527- my @sources = split /\s+/, $sources;
528-
529- my $flag_country = "";
530- if ( $keycap_name =~ /^flag for (\S.*?)\s*$/) {
531- $flag_country = $1;
532- }
533-
534- my $zsh_code = join '', map { "\\U$_" } @code_points;
535- # Convert keycap names to valid associative array names that do not require any
536- # quoting. Works fine for most stuff, but is clumsy for flags.
537- my $omz_name = lc($keycap_name);
538- $omz_name =~ s/[^A-Za-z0-9]/_/g;
539- my $zsh_flag_country = $flag_country;
540- $zsh_flag_country =~ s/[^\p{Letter}]/_/g;
541- if ($flag_country) {
542- $outfh->print("emoji_flags[$zsh_flag_country]=\$'$zsh_code'\n");
543- } else {
544- $outfh->print("emoji[$omz_name]=\$'$zsh_code'\n");
545- }
546- # Modifiers are included in both the main set and their separate map,
547- # because they have a standalone representation as a color swatch.
548- if ( $modifier_status eq "modifier" ) {
549- $outfh->print("emoji_mod[$omz_name]=\$'$zsh_code'\n");
550- }
551- } else {
552- die "Failed parsing line $line_num: '$_'";
553- }
554- }
555- $fh->close();
556- $outfh->print("\n");
557diff --git a/plugins/emoji/update_emoji.py b/plugins/emoji/update_emoji.py
558new file mode 100644
559index 0000000000000000000000000000000000000000..eb945b9ef9bb3885310bc6c110fd05b682298684
560--- /dev/null
561+++ b/plugins/emoji/update_emoji.py
562@@ -0,0 +1,213 @@
563+"""
564+Update Emoji.py
565+Refeshes OMZ emoji database based on the latest Unicode spec
566+"""
567+import re
568+import json
569+
570+spec = open("emoji-data.txt", "r")
571+
572+# Regexes
573+# regex_emoji will return, respectively:
574+# the code points, its type (status), the actual emoji, and its official name
575+regex_emoji = r"^([\w ].*?\S)\s*;\s*([\w-]+)\s*#\s*(.*?)\s(\S.*).*$"
576+# regex_group returns the group of subgroup that a line opens
577+regex_group = r"^#\s*(group|subgroup):\s*(.*)$"
578+
579+headers = """
580+# emoji-char-definitions.zsh - Emoji definitions for oh-my-zsh emoji plugin
581+#
582+# This file is auto-generated by update_emoji.py. Do not edit it manually.
583+#
584+# This contains the definition for:
585+# $emoji - which maps character names to Unicode characters
586+# $emoji_flags - maps country names to Unicode flag characters using region
587+# indicators
588+# $emoji_mod - maps modifier components to Unicode characters
589+# $emoji_groups - a single associative array to avoid cluttering up the
590+# global namespace, and to allow adding additional group
591+# definitions at run time. The keys are the group names, and
592+# the values are whitespace-separated lists of emoji
593+# character names.
594+
595+# Main emoji
596+typeset -gAH emoji
597+# National flags
598+typeset -gAH emoji_flags
599+# Combining modifiers
600+typeset -gAH emoji_mod
601+# Emoji groups
602+typeset -gAH emoji_groups
603+"""
604+
605+#######
606+# Adding country codes
607+#######
608+# This is the only part of this script that relies on an external library
609+# (country_converter), and is hence commented out by default.
610+# You can uncomment it to have country codes added as aliases for flag
611+# emojis. (By default, when you install this extension, country codes are
612+# included as aliases, but not if you re-run this script without uncommenting.)
613+# Warning: country_converter is very verbose, and will print warnings all over
614+# your terminal.
615+
616+# import country_converter as coco # pylint: disable=wrong-import-position
617+# cc = coco.CountryConverter()
618+
619+# def country_iso(_all_names, _omz_name):
620+# """ Using the external library country_converter,
621+# this funciton can detect the ISO2 and ISO3 codes
622+# of the country. It takes as argument the array
623+# with all the names of the emoji, and returns that array."""
624+# omz_no_underscore = re.sub(r'_', r' ', _omz_name)
625+# iso2 = cc.convert(names=[omz_no_underscore], to='ISO2')
626+# if iso2 != 'not found':
627+# _all_names.append(iso2)
628+# iso3 = cc.convert(names=[omz_no_underscore], to='ISO3')
629+# _all_names.append(iso3)
630+# return _all_names
631+
632+
633+#######
634+# Helper functions
635+#######
636+
637+def code_to_omz(_code_points):
638+ """ Returns a ZSH-compatible Unicode string from the code point(s) """
639+ return r'\U' + r'\U'.join(_code_points.split(' '))
640+
641+def name_to_omz(_name, _group, _subgroup, _status):
642+ """ Returns a reasonable snake_case name for the emoji. """
643+ def snake_case(_string):
644+ """ Does the regex work of snake_case """
645+ remove_dots = re.sub(r'\.\(\)', r'', _string)
646+ replace_ands = re.sub(r'\&', r'and', remove_dots)
647+ remove_whitespace = re.sub(r'[^\#\*\w]', r'_', replace_ands)
648+ return re.sub(r'__', r'_', remove_whitespace)
649+
650+ shortname = ""
651+ split_at_colon = lambda s: s.split(": ")
652+ # Special treatment by group and subgroup
653+ # If the emoji is a flag, we strip "flag" from its name
654+ if _group == "Flags" and len(split_at_colon(_name)) > 1:
655+ shortname = snake_case(split_at_colon(_name)[1])
656+ else:
657+ shortname = snake_case(_name)
658+ # Special treatment by status
659+ # Enables us to have every emoji combination,
660+ # even the one that are not officially sanctionned
661+ # and are implemeted by, say, only one vendor