polLingua Completion is a multi-language, multi-shell, highly configurable, and user-friendly Unicode path completion tool.
While the default configuration works out-of-the-box for most users, it provides extensive customization space for power users.
The v1 release features a core logic rewritten in Rust, effectively resolving performance issues. It supports static compilation and provides statically-linked binary distributions for Gnu/Linux.
- Broad Language Support: Covers CJK (Chinese, Japanese, Korean) and many other languages.
- Multi-Shell Compatibility: Supports Bash, Zsh, and Fish.
- Flexible Configuration: Full control over completion behavior via environment variables.
- Chinese:
- Mandarin:
- Putonghua Pinyin.
- Initial support for Zhuyin/Bopomofo (Taiwan).
- Cantonese (Hong Kong): Not currently supported (planned).
- Mandarin:
- Japanese: Supports Kanji/Kana to Romaji and Kanji to Kana conversion.
- Korean: Supports Hangul only; Hanja is not supported.
- Latin Script Variants: Such as Czech, etc.
- Cyrillic Script: Such as Russian.
- Greek Script.
- Note: Preliminary support for other languages exists in theory but lacks extensive testing. Feedback is welcome if you encounter issues.
Requirements:
-
Place
pollingua-completion-corein your PATH and grant execution permissions. -
sourcethe corresponding shell script file based on your environment.
- Regular Users: Typically uses
bash-completion. Supports both Native (Recommended) and fzf modes. - ble.sh Users: The above modes are unavailable; a dedicated
ble.shimplementation is provided.- Notice:
ble.shusers should useble-import -C 'source /path/to/completer_ble.sh' core-completeinstead of normal source.
- Notice:
- Please use Zsh's
compsyssystem. - In addition to
completer.zsh, you need to loadsetup.zshfor an out-of-the-box experience. The latter contains necessary configurations which users are encouraged to modify as needed. - Please use
menu-completeinstead ofexpand-or-completeto avoid a known bug.
- abbr_fzf.fish (Recommended): Implemented using Fish's
abbr(abbreviation) error-correction system and relies onfzf. This is currently the best practice. - abbr.fish: Uses the
abbrsystem withoutfzfdependency; provides basic support only.- About abbr:
abbrdoes not use the Tab key for completion; it is semi-automatic.- Manual Trigger: Type
@foo@or::foo::and press Space to automatically trigger decoding. (Behavior can be modified in the Fish scripts). - Auto Trigger: Type completable text and press Space to trigger decoding (Enabled by default for
abbr_fzf.fish, disabled forabbr.fish).
- Manual Trigger: Type
- About abbr:
- completer_fzf.fish: Use this version if you prefer traditional Tab completion (requires
fzf).
- Test Environment: Primarily tested on Gnu/Linux.
- Compatibility: Theoretically supports all Unix-like environments following XDG standards. Please report any issues.
- Binaries: Linux statically-linked binaries are provided. BSD, macOS, and other system users should compile from source.
Configuration is handled via environment variables. Remember to export them in your shell profile.
| Environment Variable | Description | Default |
|---|---|---|
POLINGUA_COMPLETION_CONVERTER_ENABLE_CHINESE |
Enable Chinese support | true |
POLINGUA_COMPLETION_CONVERTER_ENABLE_JAPANESE |
Enable Japanese support | true |
POLINGUA_COMPLETION_CONVERTER_ENABLE_KOREAN |
Enable Korean support | true |
POLINGUA_COMPLETION_CONVERTER_ENABLE_UNICODE_OTHER |
Enable other Unicode languages | true |
POLINGUA_COMPLETION_CONVERTER_ENABLE_ASCII |
Process ASCII characters | false |
POLINGUA_COMPLETION_CONVERTER_ENABLE_IDENTITY |
Match any string against itself | true |
You can customize the conversion chain for specific languages using the following variables; otherwise, complex default values are used.
-
POLINGUA_COMPLETION_CONVERTER_CONFIG_CHINESE -
POLINGUA_COMPLETION_CONVERTER_CONFIG_JAPANESE -
POLINGUA_COMPLETION_CONVERTER_CONFIG_KOREAN -
POLINGUA_COMPLETION_CONVERTER_CONFIG_UNICODE_OTHER -
POLINGUA_COMPLETION_CONVERTER_CONFIG_ASCII
Configuration Format Example:
filter(script=zh,mode=include),zh_hanzi(heteronym=true),unicode:filter(script=zh,mode=include),zh_hanzi(heteronym=true,format=first_letter),unicode:identity
-
Colons (
:) separate parallel logic. -
Commas (
,) connect sequential logic. -
Parentheses
()contain parameter lists.
Global Override:
POLINGUA_COMPLETION_CONVERTER_CONFIG: Not set by default; if set, it overrides all language-specific configurations listed above.
| Converter Name | Description | Parameters (Bold denotes default) | Notes |
|---|---|---|---|
| identity | Returns the string unchanged | -- | -- |
| unicode | Unicode to ASCII conversion | -- | -- |
| unicode_advanced | Configurable Unicode conversion | anyascii (true/false) deunicode (true/false)unidecode (true/false) |
* Select backend toggle |
| filter | Filters strings matching rules | script: (enum: zh, jp, ko, cjk, hanzi, kana, hangeul, latin, greek, cyrillic)mode: (enum: include, only, no) |
* Select language/script type * filtering criteria |
| zh_hanzi | Hanzi to Pinyin | format: (enum: full, first_letter, initials) capitalize: (enum: no, all, first_letter, initials) heteronym: (true/false) |
Alias: zh_hanzi_pinyin |
| zh_hanzi_zhuyin | Hanzi to Zhuyin | heteronym: (true/false)tone: (true/false) |
Initial support |
| jp_all | Japanese to Romaji/Kana | output: (enum: romaji, ascii, kana)nbest: (unsigned int, 1) |
* Output format (ascii is more raw) * Best matches count (suggest < 5) Alias: jp_kanji_and_kana |
| ko_hangeul | Hangul to ASCII/Jamo | output: (enum: ascii, jamo)format: (enum: full, first_letter, choseong) capitalize: (enum: no, all, choseong, first_letter) |
Similar to Chinese Pinyin converter |