DSLとuim+Anthyとvi協調モード

vimperatorには二つのモードがある。入力モードとそうでないモードだ。フォームに入力するときな入力モードになり終わったらescで抜けてvimのキー操作(Jでスクロールetc)をする。
この入力モードが曲者でIMElinuxの場合もこう読んでいいんだっけ?)がかな変換モードだとescで抜けてもvimの操作ができなかったりする。なのでいったん英字モードに戻してからescしてた。

だがなんとuimにはvi協調モードというのがあることを知った。さっそくDamn Small Linuxでプロパティを見てみた…あれ無いな
しかたないので母機のうぷんつ8をチェック…ある!
バージョンチェック
ubuntu uim 1.4.1-5
dsl uim 0.4.6final1-3s

しかたないので改造する。

cd /usr/share/uim/
*** anthy-custom.scm.orig	2008-09-22 07:30:14.000000000 +0900
--- anthy-custom.scm	2008-09-22 07:30:56.000000000 +0900
***************
*** 282,284 ****
--- 282,291 ----
  		 'custom-set-hooks
  		 (lambda ()
  		   (anthy-configure-widgets)))
+ 
+ 
+ (define-custom 'anthy-use-with-vi? #f
+   '(anthy-advanced special-op)
+   '(boolean)
+   (_ "Enable vi-cooperative mode")
+   (_ "long description will be here."))
*** anthy-key-custom.scm.orig	2008-09-22 07:57:10.000000000 +0900
--- anthy-key-custom.scm	2008-09-22 07:58:06.000000000 +0900
***************
*** 228,230 ****
--- 228,237 ----
  	       '(key)
  	       (_ "[Anthy] go right")
  	       (_ "long description will be here"))
+ 
+ (define-custom 'anthy-vi-escape-key '("escape" "<Control>[")
+                '(anthy-keys3)
+ 	       '(key)
+ 	       (_ "[Anthy] ESC keys on vi-cooperative mode")
+ 	       (_ "long description will be here"))
+ 
*** anthy.scm.orig	2008-09-22 07:31:26.000000000 +0900
--- anthy.scm	2008-09-22 07:56:28.000000000 +0900
***************
*** 409,414 ****
--- 409,420 ----
  	  (direct (ja-direct (charcode->string key)))
  	  (rule (anthy-context-input-rule ac)))
        (cond
+        ((and anthy-use-with-vi?
+              (anthy-vi-escape-key? key key-state))
+ 	(anthy-flush ac)
+ 	(anthy-context-set-on! ac #f)
+ 	(anthy-commit-raw ac)))
+       (cond
         ((anthy-wide-latin-key? key key-state)
  	(begin
  	  (anthy-flush ac)

あとは~/.uim

(define anthy-use-with-vi? #t)

とでも書いておく