Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/khaphanspace/gonhanh.org/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Gõ Nhanh supports two popular Vietnamese input methods:

Telex

Modern, letter-based method using s, f, r, x, j, w, z

VNI

Number-based method using 1, 2, 3, 4, 5, 6, 7, 8, 9, 0

Telex Input Method

Overview

Telex uses letter keys that don’t exist in Vietnamese (f, j, w, z) to add diacritics.
s = sắc   (acute)
f = huyền (grave)
r = hỏi   (hook)
x = ngã   (tilde)
j = nặng  (dot below)
z = remove last diacritic

Examples

Input      Output     Explanation
───────────────────────────────────
as         á          a + sắc
af         à          a + huyền
ar         ả          a + hỏi
ax         ã          a + ngã
aj         ạ          a + nặng

aa         â          a + circumflex
aas        ấ          â + sắc

aw         ă          a + breve
aws        ắ          ă + sắc

ow         ơ          o + horn
owf        ờ          ơ + huyền

uw         ư          u + horn
uwf        ừ          ư + huyền

dd         đ          d + stroke

Undo Mechanism

Type the same key twice to undo:
Input    Output    Explanation
───────────────────────────────
aaa      âa        aa → â, third 'a' stays
ass      as        as → á, second 's' removes sắc
aww      aw        aw → ă, second 'w' removes breve
oww      ow        ow → ơ, second 'w' removes horn
Issue #312: When a vowel already has a modifier (horn/circumflex/breve), typing the same vowel again adds it raw, not as a modifier.Example: chưa + achưaa (NOT chưâ)

Implementation

Telex is implemented in core/src/input/telex.rs:
pub struct Telex;

impl Method for Telex {
    fn mark(&self, key: u16) -> Option<u8> {
        match key {
            keys::S => Some(1), // sắc
            keys::F => Some(2), // huyền
            keys::R => Some(3), // hỏi
            keys::X => Some(4), // ngã
            keys::J => Some(5), // nặng
            _ => None,
        }
    }

    fn tone(&self, key: u16) -> Option<ToneType> {
        match key {
            keys::A | keys::E | keys::O => Some(ToneType::Circumflex),
            keys::W => Some(ToneType::Horn),
            _ => None,
        }
    }

    fn stroke(&self, key: u16) -> bool {
        key == keys::D
    }

    fn remove(&self, key: u16) -> bool {
        key == keys::Z
    }
}

VNI Input Method

Overview

VNI uses number keys (0-9) to add diacritics.
1 = sắc   (acute)
2 = huyền (grave)
3 = hỏi   (hook)
4 = ngã   (tilde)
5 = nặng  (dot below)
0 = remove last diacritic

Examples

Input      Output     Explanation
───────────────────────────────────
a1         á          a + sắc
a2         à          a + huyền
a3         ả          a + hỏi
a4         ã          a + ngã
a5         ạ          a + nặng

a6         â          a + circumflex
a61        ấ          â + sắc

a8         ă          a + breve
a81        ắ          ă + sắc

o7         ơ          o + horn
o72        ờ          ơ + huyền

u7         ư          u + horn
u72        ừ          ư + huyền

d9         đ          d + stroke

Implementation

VNI is implemented in core/src/input/vni.rs:
pub struct Vni;

impl Method for Vni {
    fn mark(&self, key: u16) -> Option<u8> {
        match key {
            keys::N1 => Some(1), // sắc
            keys::N2 => Some(2), // huyền
            keys::N3 => Some(3), // hỏi
            keys::N4 => Some(4), // ngã
            keys::N5 => Some(5), // nặng
            _ => None,
        }
    }

    fn tone(&self, key: u16) -> Option<ToneType> {
        match key {
            keys::N6 => Some(ToneType::Circumflex),
            keys::N7 => Some(ToneType::Horn),
            keys::N8 => Some(ToneType::Breve),
            _ => None,
        }
    }

    fn stroke(&self, key: u16) -> bool {
        key == keys::N9
    }

    fn remove(&self, key: u16) -> bool {
        key == keys::N0
    }
}

Tone Placement Rules

Gõ Nhanh follows official Vietnamese tone placement rules (Quy tắc đặt dấu thanh).

Rule 1: Single Vowel

Tone mark goes directly on the vowel:
bá, bà, bả, bã, bạ

Rule 2: Two Vowels

Check the pattern in this table:
PatternTone PositionExample
ai, ayFirstmái, máy
ao, auFirstsáo, sáu
âu, âyFirstcấu, cây
eo, êuFirstkéo, kêu
ia, iêSecondkía, tiếng
iuFirsttíu
oa, oăSecondhoá, xoắn
oeSecondkhoé
oi, ôiFirsttói, tôi
ơiFirstcơi
uaFirst/Secondmúa / quá
uê, uySecondtuế, thuý
ui, uôFirsttúi, cuốn
ưa, ươFirstmứa, được
ưi, ưuFirstgửi, lưu
Secondyếu
Special case for “ua”:
  • After q: tone on a (quá, quả)
  • Without q (open syllable): tone on u (múa, cúa)
  • With final consonant: tone on a (muán, quán)

Rule 3: Three Vowels

Tone mark goes on the middle vowel (with modifier if present):
PatternTone PositionExample
iêuêtiêu, kiều
yêuêyêu
oaiangoài, loại
oayaxoáy
oeoekhoẻo
uâyâkhuấy
uôiôcuối, tuổi
ươiơmười, tươi
ươuơrượu, hươu
uyêêquyền, chuyện

Old vs New Style

There are two schools of tone placement for some patterns:
PatternOld StyleNew StyleNote
oahòahoàOld: tone on o
oehòehoèNew: tone on a/e
uythùythuỳ(per Bộ GD&ĐT 2018)
Gõ Nhanh uses the new style by default (following Ministry of Education Decision 1989/QĐ-BGDĐT, 2018).

Validation

Gõ Nhanh validates Vietnamese syllables using a whitelist approach:

Valid Patterns

ai, ao, au, ay, âu, ây, eo, êu,
ia, iê, iu, oa, oă, oe, oi, ôi, ơi,
ua, uâ, uê, ui, uô, uy, ưa, ưi, ươ, ưu, yê
iêu, yêu, oai, oay, oeo, uây, uôi, ươi, ươu, uyê
ea, ou, yo, eu (without circumflex), ae, yi, wu
These patterns are NOT valid in Vietnamese and are rejected by the engine.

Auto-Capitalization

Gõ Nhanh automatically capitalizes the first letter after:
  • Period (.)
  • Exclamation mark (!)
  • Question mark (?)
  • Enter key
chào bạn. bạn khỏe không?
         ↑ Auto-capitalized
         
Result: Chào bạn. Bạn khỏe không?

FAQ

Yes! Go to Settings → General → Input Method and select your preferred method. The change takes effect immediately.
In Telex, e + eê and x → ngã. Use Auto-Restore by pressing Space, or press ESC to restore manually.
No, key mappings are fixed to follow standard Telex and VNI conventions. This ensures compatibility with other Vietnamese IMEs.

Technical Reference

For complete Vietnamese language rules, see:

Auto-Restore

Automatic English word restoration

Shortcuts

Text expansion shortcuts