jump+toggle no longer works
make the keybind toggle radicals
don't assume the AUR helper
Some simple tools for learning Japanese in the terminal.
You can use sdcv as a terminal dictionary. Install it from your package manager and download JMDict-ja-en and Kanjidic2 from http://download.huzheng.org/ja/ to ~/.local/share/stardict/dic
.
Once you reach a high enough level, you will want the monolingual daijirin dictionary since it has the most information, but this requires some work since it's copyrighted and in an exoteric format:
convert-daijirin.php
stardict-tools-git
on the AUR, apt install stardict-tools
on Debian)stardict-tabfile daijirin.tab
(Arch) / tabfile daijirin.tab
(Debian)mv daijirin.{dict,idx,ifo} ~/.local/share/stardict/dic
This consists of a zsh script that parses the RADKFILE, and a shell function that lets you select a kanji with fzf, and looks it up in sdcv.
curl ftp://ftp.monash.edu/pub/nihongo/radkfile.gz | gunzip | iconv -f EUC-JP -t UTF-8 -o ${XDG_DATA_HOME:-~/.local/share}/radkfile
radicals.zsh
to ~/.local/lib
zshrc
/bashrc
: radicals() { ~/.local/lib/radicals.zsh $(awk '/^\$/ {print NR,$2,$3 }' ${XDG_DATA_HOME-~/.local/share}/radkfile | fzf -m --with-nth=2,3 --bind=ctrl-l:jump --preview='~/.local/lib/radicals.zsh {+1}' | cut -d ' ' -f 1) | fzf --bind=ctrl-l:jump-accept | sdcv; }
You use this by selecting the radicals of the kanji you want to look up and pressing Tab. You can filter the selections by typing the stroke count, and can move down with Ctrl+j or by showing labels you can jump to with Ctrl+l (mnemonic: label). As you select radicals, the preview window will the show the kanji that contain them. Once you find your kanji, press enter, select it in the new fzf instance, and sdcv will show its definition.
A lightweight alternative to IBus that interacts with Anthy on standard input and output. This converts one word at a time, so it's only viable if you mostly just read Japanese rather than writing it.
/opt/anthy
anthy.patch
with, for example, patch -p1 < ../japanese-cli/anthy.patch
. This removes most printf calls and makes it read from standard input./configure && make
CARGO_HOME=~/.local/share/cargo cargo install to-kana
for a program that converts romaji to hiraganawtype $(fzfmenu --disabled --bind='change:reload(cd /opt/anthy/test; ~/.local/share/cargo/bin/to-kana hira {q} | ./anthy),ctrl-l:jump-accept' < /dev/null)