diff options
Diffstat (limited to '.emacs.d/lisp/init-input-method.el')
-rw-r--r-- | .emacs.d/lisp/init-input-method.el | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/.emacs.d/lisp/init-input-method.el b/.emacs.d/lisp/init-input-method.el index 5c0c61b..11fcb78 100644 --- a/.emacs.d/lisp/init-input-method.el +++ b/.emacs.d/lisp/init-input-method.el @@ -7,13 +7,25 @@ (setq sis-external-ism "/usr/local/bin/macism") (setq sis-english-source "com.apple.keylayout.ABC" sis-other-source "com.apple.inputmethod.SCIM.ITABC") + (setq sis-do-get + (lambda () + (string-trim (shell-command-to-string sis-external-ism)))) + (setq sis-do-set + (lambda (source) + (start-process "set-input-source" nil + sis-external-ism source))) + + (setq gx/input-method--insert-state-source sis-english-source) (when (gx/maybe-require-package 'sis) - (add-hook 'after-init-hook + (add-hook 'evil-insert-state-exit-hook (lambda () - (sis-global-respect-mode t) - (sis-global-context-mode t)))) - - (with-eval-after-load 'sis - (add-hook 'evil-insert-state-exit-hook 'sis-set-english))) + (setq gx/input-method--insert-state-source (sis-get)) + (sis-set-english))) + (add-hook 'evil-insert-state-entry-hook + (lambda () + (unless (minibufferp) + (when (string= gx/input-method--insert-state-source + sis-other-source) + (sis-set-other))))))) (provide 'init-input-method) |