2004-07-07 (Wed)
_ [ソフトウェア] uim-primeのvi対応
viでuim-primeを使っていると、ついつい英数モードにするのを忘れて escapeを押してしまう。
anthy-dev MLで聞いてみたところ、.uimにこんなのを入れとけば、escapeの 時に自動で英数モードにできるようだ。
(define prime-push-key-orig prime-push-key)
(set! prime-push-key
(lambda (c key key-state)
(if (or (= key 'escape)
(and (= key 91) ;; [
(= key-state 2))) ;; control
(let ((sc (context-data c))
(id (context-id c)))
(prime-context-set-mode! sc prime-mode-latin)
(prime-update-mode id sc)))
(prime-push-key-orig c key key-state)))
ついでに、もう一度iとかでinsert modeに戻る時に、前のuim-primeの モードに戻すようにしてみた。
(define prime-suspended-mode -1)
(define prime-in-vi-c-command #f)
(define prime-context-set-mode-orig! prime-context-set-mode!)
(set! prime-context-set-mode!
(lambda (ac mode)
(set! prime-suspended-mode -1)
(set! prime-in-vi-c-command #f)
(prime-context-set-mode-orig! ac mode)))
(define prime-push-key-orig prime-push-key)
(set! prime-push-key
(lambda (c key key-state)
(let* ((sc (context-data c))
(mode (prime-context-mode sc)))
(prime-push-key-orig c key key-state)
(cond
((and (not (= mode prime-mode-latin))
(or (= key 'escape)
(and (= key 91) ;; [
(= key-state 2)))) ;; control
(prime-context-set-mode-orig! sc prime-mode-latin)
(prime-update-mode (context-id c) sc)
(set! prime-suspended-mode mode)
(set! prime-in-vi-c-command #f))
((and (= mode prime-mode-latin)
(>= prime-suspended-mode 0))
(cond
((or (= key 105) ;; i
(= key 73) ;; I
(= key 97) ;; a
(= key 65) ;; A
(= key 111) ;; o
(= key 79) ;; O
(= key 67) ;; C
(= key 115) ;; s
(= key 83) ;; S
(and prime-in-vi-c-command
(or (= key )
(= key 108) ;; l
(= key 119) ;; w
(= key 101) ;; e
(= key 99) ;; c
(= key 71)))) ;; G
(prime-context-set-mode-orig! sc prime-suspended-mode)
(prime-update-mode (context-id c) sc)
(set! prime-suspended-mode -1)
(set! prime-in-vi-c-command #f))
((= key 99) ;; c
(set! prime-in-vi-c-command #t))
((or (= key 58) ;; :
(= key 47) ;; /
(= key 63) ;; ?
(= key 33) ;; !
(= key 'escape))
(set! prime-suspended-mode -1)
(set! prime-in-vi-c-command #f))))))))
やっぱりSchemeは日常的に使うのはつらそうだなあ。 自分の能力的に。
_ [mod_ruby] modruby.net
リニューアルしました。
[ツッコミを入れる]
[TrackBack URL: http://shugo.net/jit/tb.rb/20040707]
本日のリンク元
- http://arika.org/diary/ ×19
- http://blog.chew.jp/result/qt/qt uim-qt ×11
- http://arika.org/diary/20041009 ×7
- http://sbs.mobile.yahoo.co.jp/union/search?fr=m_to... ×4
- http://arika.org/diary/200410 ×3
- http://search.live.com/results.aspx?q=prime&mrt=en... ×2
- http://search.live.com/results.aspx?q=prime&form=Q... ×2
- http://search.live.com/results.aspx?mkt=es-es&FORM... ×2
- http://search.live.com/results.aspx?q=prime ×2
- http://mixi.jp/home.pl ×2
- http://search.www.infoseek.co.jp/OTitles?qt=T・PRIM... ×1
- http://looseend.ddo.jp/blog/categorylist_html?cat_... ×1
- http://mixi.jp/ ×1
- http://gogogo.go2.jp/www/yws_wd=vi|page=1.html ×1
- http://blog.chew.jp/result/qt/qt uim ×1
