20 Jul 2013 by dryobates
If you are Vim user and you need to type some japanese signs into your documents from time to time then read this and see how simple it can be done.
From time to time I input new kanji symbols into OpenOffice document and when there is whole new page I print it to have some quick reference when I forgot some of them.
Until today I did it in a manner which is shameful for vim user. It is even shameful for unix user ;) I was staring Windows, run OpenOffice, change keyboard layout and input kanji symbols. Enough!
Today, when I was going to write some new part of kanji I recalled that some time ago I had installed SCIM . It allowed to input kanji in X. Quick googling showed that SCIM still exists but there’s also new player: IBus . I wouldn’t be myself if I won’t give it a try.
I have installed it like from FreeBSD ports:
$ portmaster japanese/ibus-anthy
In order to enable ibus we need start it at the begining of our X session. I have added it to my .xinitrc:
export XIM=ibus export GTK_IM_MODULE=ibus export QT_IM_MODULE=xim export XMODIFIERS=@im=ibus export XIM_PROGRAM="ibus-daemon" export XIM_ARGS="--daemonize --xim" $XIM_PROGRAM $XIM_ARGS &
After restart of my window manager (awesome) on my systray appeared ibus icon (keyboard with globe). Right click on it, then select Preferences -> Input method -> Japanese -> Anthy. Click Add and Close. By pressing Ctrl-Space I can switch input methods and input kanji 日本語.
But it doesn’t work in console programs... Yet. If you use urxvt  as your terminal as I do then you are lucky. Into your .Xdefaults/.Xresources file add:
URxvt.inputMethod: ibus URxvt.preeditType: OverTheSpot
Now in vim or Mutt running in urxvt you can input kanji with ease.
|||Smart Common Input Method - input framework method for unix: http://www.scim-im.org/|
|||Intelligent Input Bus - input framework method for unix: http://code.google.com/p/ibus/|
|||rxvt-unicode - terminal emulator with unicode support: http://software.schmorp.de/pkg/rxvt-unicode.html|