How to type macrons, accents and other diacritics in easily in Windows Using Espanso Sugam Pokharel
Typing macrons, accents and other diacritics in windows is difficult. When typing Sanskrit, I would often first type in Devanagari manually and then transliterate it using a transliterator online to get the Romanized IAST text. But transliterating again and again is tedious. Copying single ā’s and ū’s is even more painstaking.
Apparently there is an easier way. You don’t need to download a special keyboard for another language or remember what letter goes where as you can set the rules yourself.
We’ll use Espanso. It is a free and open source text expansion tool, that is to say you can set up ways that if you type certain things, it will automatically convert them to some other text that you decided. I’m using IAST transliteration scheme for Sanskrit as an example here but you can, with some time, devise this for any language and their transliteration. You could even do typing to devanagari or greek alphabet with some complex ruleset.
Step 1
Download espanso. Go to this link. There are installation options for various operating systems. You can choose according to your device. I use Windows. So, this post focuses on Windows. Choose Installer (64-bit) and install. The installation should be pretty self explanatory.
Step 2
After installation, open the espanso app and make sure it is running.
Step 3
Then go to AppData folder in your device. It is usually in an address like C:\Users\User\AppData\Roaming\espanso\match
Inside this folder, you will see a file named
base.yml. Open it. If you have an IDE like VSCode, it will automatically open there. Otherwise, you can open it in notepad.
# espanso match file# For a complete introduction, visit the official docs at: https://espanso.org/docs/# You can use this file to define the base matches (aka snippets)# that will be available in every application when using espanso.# Matches are substitution rules: when you type the "trigger" string# it gets replaced by the "replace" string.# yaml-language-server: $schema=https://raw.githubusercontent.com/espanso/espanso/dev/schemas/match.schema.jsonmatches:
# Simple text replacement - trigger: ":espanso"replace: "Hi there!"# NOTE: espanso uses YAML to define matches, so pay attention to the indentation!# But matches can also be dynamic:# Print the current date - trigger: ":date"replace: "{{mydate}}"vars:
- name: mydatetype: dateparams:
format: "%m/%d/%Y"# Print the output of a shell command - trigger: ":shell"replace: "{{output}}"vars:
- name: outputtype: shellparams:
cmd: "echo 'Hello from your shell'"# And much more! For more information, visit the docs: https://espanso.org/docs/
We care only for the part below ‘match’. There we can see ’trigger’ and ‘replace’ with their corresponding value. Currently there is only one pair.
YML
1
2
3
4
matches:
# Simple text replacement - trigger: ":espanso"replace: "Hi there!"
What this does is that if you type “:espanso”, the software will automatically replace it with “Hi there!”. Try to write (not copy) “:espanso” yourself.
In the matches, we can add our own values to trigger-replace pairs to help us write. For example, add this in the ‘matches’(make sure the indentation is correct) and save the file:
YML
1
2
- trigger: "^a"replace: "ā"
Now if you try to type “^a”, you will automatically get “ā”. You can add as many diacritics as you need.
Using common signs like “.” or “;” which are used commonly in typing other things may lead to these replacements occuring even in places where you don’t want them to. Also having a consistent scheme (like “^” for macrons, or “&” for acute accents can make remembering these easier). That said you can add them as freely as you like. You can replace whole sentences as well.Typing IAST in Windows
Step 5
For Sanskrit and IAST, I have made added the values for my own use. You can create your own or you can just copy paste this if you want. I will explained the scheme below the yml file:
Every rule has a matching capital-letter version (e.g. “^A → Ā”), written out explicitly in the file rather than relying on espanso’s automatic case handling.
Of Course you don’t have to copy this and can make your own scheme.