IPA symbols in Sublime Text

phonetics
tips
teaching
macros
Author

Guilherme D. Garcia

Published

February 18, 2024

Modified

December 18, 2024

Sublime Text is my text editor of choice, and I often use it during class (online or in person) to make plain notes on the screen. I often need to type IPA symbols, and while there are several options to do that, it’s nice to be able to do it quickly on Sublime so I don’t have to use my mouse nor leave the app (e.g., I also use LaTeXit, but mostly for non-linear structures). Ultimately, I want to be able to do it quickly, since anything too convoluted will have been done before, not during, class. I do have the IPA Unicode keyboard layout installed, but I find it suboptimal. Finally, apps such as Ukelele allow you to create a custom keyboard layout, but since I really only need this in Sublime, what follows is the easiest/most practical option I’ve tested thus far.

Sublime completions

One easy way to do that is to create a .sublime-completions file containing different IPA symbols. Simply put, this allows you to create a list of substitutions that are triggered by specific characters. Once you’ve created the file, place it in the following location: .../Library/Application Support/Sublime Text/Packages/User/.

Here’s an example: {"trigger": "ae-æ", "contents": "æ"}. Here, the trigger is ae, that’s what you’d need to type before hitting Tab. The contents bit is the symbol you want to insert. The reason why I like to have the symbol in the trigger as well is because you can preview the symbol before selecting it. That’s useful because the triger is greedy: if you press a and hit Tab, all triggers containing a will be listed (see gif below), regardless of the position of the character in the trigger. This is especially important since you’ll want to have intuitive shortcuts. In the file example at the bottom of the page, I use some of the tipa shortcuts, but it doesn’t really matter in the end considering the greedy matching of triggers.1

How to use completions in Sublime Text

How to use completions in Sublime Text

Limitations

There are two minor limitations, which shouldn’t be an issue given that the goal here is simply to type some IPA symbols when taking notes during class. First, while you can add diacritics (see file below), the example here won’t work for diacritics on top of or under segments (unless you include host and diacritic together). So you can add stress and length diacritics, but adding devoicing to a segment won’t work. Second, you need a space between symbols to activate triggers with Tab (see gif).

{
    "completions": [

// Vowels:
        {"trigger": "ae-æ", "contents": "æ"},
        {"trigger": "OE-ɶ", "contents": "ɶ"},
        {"trigger": "A-ɑ", "contents": "ɑ"},
        {"trigger": "6-ɒ", "contents": "ɒ"},
        {"trigger": "5-ɐ", "contents": "ɐ"},
        {"trigger": "schwar-ɚ", "contents": "ɚ"},
        {"trigger": "schwa-ə", "contents": "ə"},
        {"trigger": "Er-ɝ", "contents": "ɝ"},
    
        {"trigger": "E-ɛ", "contents": "ɛ"},
        {"trigger": "oe-œ", "contents": "œ"},
        {"trigger": "3-ɜ", "contents": "ɜ"},
        {"trigger": "E-ɞ", "contents": "ɞ"},
        {"trigger": "2-ʌ", "contents": "ʌ"},
        {"trigger": "O-ɔ", "contents": "ɔ"},
        {"trigger": "o-ø", "contents": "ø"},
        {"trigger": "9-ɘ", "contents": "ɘ"},
        {"trigger": "8-ɵ", "contents": "ɵ"},
        {"trigger": "7-ɤ", "contents": "ɤ"},
        {"trigger": "I-ɪ", "contents": "ɪ"},
        {"trigger": "Y-ʏ", "contents": "ʏ"},
        {"trigger": "U-ʊ", "contents": "ʊ"},
        {"trigger": "1-ɨ", "contents": "ɨ"},
        {"trigger": "0-ʉ", "contents": "ʉ"},
        {"trigger": "W-ɯ", "contents": "ɯ"},

// Consonants:
        {"trigger": "t-ʈ", "contents": "ʈ"},
        {"trigger": "d-ɖ", "contents": "ɖ"},
        {"trigger": "j-ɟ", "contents": "ɟ"},
        {"trigger": "g-ɢ", "contents": "ɢ"},
        {"trigger": "P-ʔ", "contents": "ʔ"},
        {"trigger": "M-ɱ", "contents": "ɱ"},
        {"trigger": "n-ɳ", "contents": "ɳ"},
        {"trigger": "N-ŋ", "contents": "ŋ"},
        {"trigger": "n-ɴ", "contents": "ɴ"},
        {"trigger": "B-ʙ", "contents": "ʙ"},
        {"trigger": "r-ʀ", "contents": "ʀ"},
        {"trigger": "v-ⱱ", "contents": "ⱱ"},
        {"trigger": "r-ɾ", "contents": "ɾ"},
        {"trigger": "r-ɽ", "contents": "ɽ"},
        {"trigger": "F-ɸ", "contents": "ɸ"},
        {"trigger": "B-β", "contents": "β"},
        {"trigger": "T-θ", "contents": "θ"},
        {"trigger": "D-ð", "contents": "ð"},  
        {"trigger": "S-ʃ", "contents": "ʃ"},
        {"trigger": "Z-ʒ", "contents": "ʒ"},
        {"trigger": "s-ʂ", "contents": "ʂ"},
        {"trigger": "z-ʐ", "contents": "ʐ"},
        {"trigger": "j-ʝ", "contents": "ʝ"},
        {"trigger": "G-ɣ", "contents": "ɣ"},
        {"trigger": "X-χ", "contents": "χ"},
        {"trigger": "R-ʁ", "contents": "ʁ"},
        {"trigger": "h-ħ", "contents": "ħ"},
        {"trigger": "Q-ʕ", "contents": "ʕ"},
        {"trigger": "h-ɦ", "contents": "ɦ"},
        {"trigger": "l-ɬ", "contents": "ɬ"},
        {"trigger": "lZ-ɮ", "contents": "ɮ"},
        {"trigger": "v-ʋ", "contents": "ʋ"},
        {"trigger": "r-ɹ", "contents": "ɹ"},
        {"trigger": "r-ɻ", "contents": "ɻ"},
        {"trigger": "w-ɰ", "contents": "ɰ"},
        {"trigger": "l-ɭ", "contents": "ɭ"},
        {"trigger": "L-ʎ", "contents": "ʎ"},
        {"trigger": "l-ʟ", "contents": "ʟ"},
        {"trigger": "hui-ɥ", "contents": "ɥ"},

// Diacritics:

        {"trigger": "ps-ˈ", "contents": "ˈ"},
        {"trigger": "ss-ˈ", "contents": "ˌ"},
        {"trigger": "long-ː", "contents": "ː"},
        {"trigger": "l-l̥", "contents": "l̥"},
        {"trigger": "r-ɹ̥", "contents": "ɹ̥"},
        {"trigger": "tS-t͡ʃ", "contents": "t͡ʃ"},
        {"trigger": "dZ-d͡ʒ", "contents": "d͡ʒ"},
        
        {"trigger": "ts-t͡s", "contents": "t͡s"},
        {"trigger": "dz-d͡z", "contents": "d͡z"},

        {"trigger": "p-p̚", "contents": "p̚"},
        {"trigger": "t-t̚", "contents": "t̚"},
        {"trigger": "k-k̚", "contents": "k̚"},

        {"trigger": "i-i̥", "contents": "i̥"},
        {"trigger": "u-u̥", "contents": "u̥"},
        

// Greek letters:
        {"trigger": "alpha-⍺", "contents": "⍺"},
        {"trigger": "beta-β", "contents": "β"},
        {"trigger": "gamma-Ɣ", "contents": "Ɣ"},
// Prosody:
        {"trigger": "omega-ω", "contents": "ω"},
        {"trigger": "Sigma-Σ", "contents": "Σ"},
        {"trigger": "sigma-σ", "contents": "σ"},
        {"trigger": "mu-µ", "contents": "µ"},

// Stats:
        {"trigger": "y-hat-ŷ", "contents": "ŷ"},
        {"trigger": "beta-hat-β̂", "contents": "β̂"}
    ]
}

Snippets + completions

As I use Sublime as my go-to notes tool in class (i.e., my blackboard), I also have some useful phonology snippets set up (some of which briefly appear in the gif above). Here’s one practical example of a snippet for a simple SPE rule (which I summon by typing spe and hitting Tab) where I also use IPA completions.

SPE snippet + IPA completion

SPE snippet + IPA completion

What the spe snippet looks like

Simply go to Tools > Developer > New Snippet... and replace the text with the snippet below. Then save it with a .sublime-snippet extension in the appropriate folder (.../Packages/User).

<snippet>
    <content><![CDATA[
/${1:X}/ → [${2:Y}] / __ ${3:C}
    ]]></content>
    <tabTrigger>spe</tabTrigger>
    <description>SPE Rule</description>
</snippet>

Copyright © 2024 Guilherme Duarte Garcia

Footnotes

  1. You may see the lorem snippet summoned by Tab when you try this on your Sublime. You can delete the snipped in question by installing PackageResourceViewer. Then, go to PackageResourceViewer: Open Resource from the command palette. Next, choose Text, Snippets, lorem.sublime-snippet. Simply delete the text, save, and restart Sublime Text.↩︎