Skip to content

Instantly share code, notes, and snippets.

@jiahut
Last active January 17, 2019 08:58
Show Gist options
  • Save jiahut/70d12b4f08349b71433bac305acc413f to your computer and use it in GitHub Desktop.
Save jiahut/70d12b4f08349b71433bac305acc413f to your computer and use it in GitHub Desktop.
;; You need to install https://github.com/vovkasm/input-source-switcher
;; In thу Terminal # issw show you namу of the current layout
;; (setq issw_default_lang_source "com.sogou.inputmethod.sogou.pinyin")
(setq issw_default_lang_source "com.apple.keylayout.US")
(defun my/enter-evil-state-hook()
(interactive)
(shell-command (concat "issw " issw_default_lang_source)))
(defun my/exit-evil-state-hook()
(interactive)
(setq issw_default_lang_source (shell-command-to-string "issw"))
(shell-command "issw com.apple.keylayout.US"))
(add-hook 'evil-hybrid-state-entry-hook 'my/enter-evil-state-hook)
(add-hook 'evil-hybrid-state-exit-hook 'my/exit-evil-state-hook)
;; (add-hook 'evil-emacs-state-entry-hook 'my/enter-evil-state-hook)
;; (add-hook 'evil-emacs-state-exit-hook 'my/exit-evil-state-hook)
;; (add-hook 'evil-insert-state-entry-hook 'my/enter-evil-state-hook)
;; (add-hook 'evil-insert-state-exit-hook 'my/exit-evil-state-hook)
;; (add-hook 'evil-replace-state-entry-hook 'my/enter-evil-state-hook)
;; (add-hook 'evil-replace-state-exit-hook 'my/exit-evil-state-hook)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment