From 34bf023d031ee254b88963d9c305c81dd1230d90 Mon Sep 17 00:00:00 2001 From: Fanyu Meng Date: Tue, 30 Jul 2019 23:11:56 -0700 Subject: [PATCH] [feature] initial commit --- .gitignore | 159 ++++++++++++++++++++++++++++ create_plist.py | 8 ++ shortcuts.py | 269 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 436 insertions(+) create mode 100644 .gitignore create mode 100644 create_plist.py create mode 100644 shortcuts.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cb1b063 --- /dev/null +++ b/.gitignore @@ -0,0 +1,159 @@ +### macOS template + +# General +**/.DS_Store +**/.AppleDouble +**/.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Python template + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +### Custom + +Text Substitutions.plist diff --git a/create_plist.py b/create_plist.py new file mode 100644 index 0000000..3621d03 --- /dev/null +++ b/create_plist.py @@ -0,0 +1,8 @@ +import plistlib + +from shortcuts import shortcuts + +full_shortcuts = [{'phrase': v, 'shortcut': '\\' + k} for k, v in shortcuts.items()] +full_shortcuts += [{'phrase': v, 'shortcut': 'v' + k} for k, v in shortcuts.items()] +with open('Text Substitutions.plist', 'wb') as f: + f.write(plistlib.dumps(full_shortcuts, sort_keys=False)) diff --git a/shortcuts.py b/shortcuts.py new file mode 100644 index 0000000..dc85f67 --- /dev/null +++ b/shortcuts.py @@ -0,0 +1,269 @@ +shortcuts = { + # macOS commands + "apple": "", + "cmd": "⌘", + "ctrl": "⌃", + "option": "⌥", + "shift": "⇧", + "capslock": "⇪", + "tab": "⇥", + "eject": "⏏", + "return": "↩", + "delete": "⌫", + "esc": "⎋", + "space": "␣", + # math symbols + "pm": "±", + "mp": "∓", + "times": "×", + "div": "÷", + "cdot": "·", + "ast": "*", + "star": "⋆", + "dagger": "†", + "ddagger": "‡", + "amalg": "⨿", + "cap": "∩", + "cup": "∪", + "uplus": "⨄", + "sqcap": "⊓", + "sqcup": "⊔", + "vee": "∨", + "wedge": "∧", + "oplus": "⊕", + "ominus": "⊖", + "otimes": "⊗", + "circ": "∘", + "bullet": "∙", + "diamond": "⋄", + "lhd": "⊲", + "rhd": "⊳", + "unlhd": "⊴", + "unrhd": "⊵", + "oslash": "⊘", + "odot": "⊙", + "bigcirc": "○", + "triangleleft": "◂", + "bigdiamond": "◇", + "bigtriangleup": "▴", + "bigtriangledown": "▾", + "bigbox": "☐", + "triangleright": "▸", + "wr": "≀", + "sqrt": "√", + "triangledown": "▾", + # relations + "le": "≤", + "ge": "≥", + "neq": "≠", + "sim": "~", + "ll": "≪", + "gg": "≫", + "doteq": "≐", + "simeq": "≃", + "subset": "⊂", + "supset": "⊃", + "approx": "≈", + "asymp": "≍", + "subseteq": "⊆", + "supseteq": "⊇", + "cong": "≅", + "smile": "⌣", + "sqsubset": "⊏", + "sqsupset": "⊐", + "equiv": "≡", + "frown": "⌢", + "sqsubseteq": "⊑", + "sqsupseteq": "⊒", + "propto": "∝", + "bowtie": "⋈", + "in": "∈", + "ni": "∋", + "prec": "≺", + "succ": "≻", + "vdash": "⊢", + "dashv": "⊣", + "preceq": "≼", + "succeq": "≽", + "models": "⊨", + "perp": "⊥", + "parallel": "∥", + "bumpeq": "≏", + "not": "̷", + # Greek letters + "alpha": "α", + "beta": "β", + "gamma": "γ", + "biggamma": "Γ", + "delta": "δ", + "bigdelta": "Δ", + "epsilon": "ϵ", + "varepsilon": "ε", + "zeta": "ζ", + "eta": "η", + "theta": "θ", + "vartheta": "ϑ", + "bigtheta": "Θ", + "iota": "ι", + "kappa": "κ", + "lambda": "λ", + "biglambda": "Λ", + "mu": "μ", + "nu": "ν", + "xi": "ξ", + "bigxi": "Ξ", + "pi": "π", + "varpi": "ϖ", + "bigpi": "Π", + "rho": "ρ", + "varrho": "ϱ", + "sigma": "σ", + "varsigma": "ς", + "bigsigma": "Σ", + "tau": "τ", + "upsilon": "υ", + "bigupsilon": "ϒ", + "phi": "ϕ", + "varphi": "φ", + "bigphi": "Φ", + "chi": "χ", + "psi": "ψ", + "bigpsi": "Ψ", + "omega": "ω", + "bigomega": "Ω", + # arrows + "right": "→", + "rightarrow": "→", + "bigrightarrow": "⇒", + "hookrightarrow": "↪︎", + "rightharpoonup": "⇀", + "rightharpoondown": "⇁", + "to": "→", + "mapsto": "↦", + "leadsto": "↝", + + "left": "←", + "leftarrow": "←", + "bigleftarrow": "⇐", + "hookleftarrow": "↩︎", + "leftharpoonup": "↼", + "leftharpoondown": "↽", + "gets": "←", + + "up": "↑", + "uparrow": "↑", + "biguparrow": "⇑", + + "down": "↓", + "downarrow": "↓", + "bigdownarrow": "⇓", + + "leftright": "↔︎", + "leftrightarrow": "↔︎", + "bigleftrightarrow": "⇔", + "rightleftharpoons": "⇌", + + "updown": "↕︎", + "updownarrow": "↕︎", + "bigupdownarrow": "⇳", + + "ne": "↗︎", + "se": "↘︎", + "sw": "↙︎", + "nw": "↖︎", + "nearrow": "↗︎", + "searrow": "↘︎", + "swarrow": "↙︎", + "nwarrow": "↖︎", + # dots + "vdots": "⋮", + "dots": "…", + "cdots": "⋯", + "ddots": "⋰", + "iddots": "⋱", + # accents + "hat": "̂", + "check": "̌", + "dot": "̇", + "breve": "̆", + "acute": "́", + "ddot": "̈", + "grave": "̀", + "tilde": "̃", + "mathring": "̊", + "bar": "̄", + "vec": "⃗", + # brackets + "lfloor": "⌊", + "rfloor": "⌋", + "lceil": "⌈", + "rceil": "⌉", + "langle": "〈", + "rangle": "〉", + # multisized + "int": "∫", + "oint": "∮", + "sum": "∑", + "prod": "∏", + "coprod": "∐", + # others + "infty": "∞", + "triangle": "△", + "angle": "∠", + "aleph": "ℵ", + "hbar": "ℏ", + "imath": "𝚤", + "jmath": "𝚥", + "ell": "ℓ", + "wp": "℘", + "bigre": "ℜ", + "mho": "℧", + "prime": "′", + "emptyset": "∅", + "nabla": "∇", + "surd": "√", + "partial": "∂", + "top": "⊤", + "bot": "⊥", + "vdash": "⊢", + "dashv": "⊣", + "forall": "∀", + "exists": "∃", + "neg": "¬", + "flat": "♭", + "natural": "♮", + "sharp": "♯", + "spadesuit": "♠", + "heartsuit": "♥", + "clubsuit": "♣", + "diamondsuit": "♦", + "blacksquare": "▪", + "bigs": "§", + "bigp": "¶", + "copyright": "©", + "bigstar": "★", + "checkmark": "✓", + # mathbb + "bbc": "ℂ", + "bbn": "ℕ", + "bbq": "ℚ", + "bbr": "ℝ", + "bbz": "ℤ", + # mathcal + "calb": "ℬ", + "cale": "ℰ", + "calh": "ℋ", + "call": "ℒ", + "calm": "ℳ", + "calr": "ℛ", + # European language symbols + "oe": "œ", + "bigoe": "Œ", + "ae": "æ", + "bigae": "Æ", + "o": "ø", + "bigo": "Ø", + "l": "ł", + "bigl": "Ł", + "ss": "ß", +}