cute-jumper / fcitx.el

Better fcitx integration for Emacs.
129 stars 16 forks source link

evil 设置问题 #25

Closed transtone closed 8 years ago

transtone commented 8 years ago

这个项目非常棒,解决了我在 emacs 的 evil 模式中频繁切换输入法的问题。 但和之前我直接用 fcitx-remote -c 相比,它太智能了:在编辑模式开启输入法 --> 一般模式自动关闭 --> 回到编辑模式自动开启。我只想用前一半的功能,也就是按 ESC 之后,我希望输入法永久关闭,而不是临时关闭,回到编辑模式也不开启。

也就是说,我只想在 esc 的时候触发,在按 i, a 等进入编辑模式的按键时不再触发

请问如何设置?

cute-jumper commented 8 years ago

这种情况建议直接添加关闭函数到对应的 hook 中即可。比如你把 fcitx--deactivate 添加到 evil-normal-state-exit-hook 上:

(add-hook 'evil-normal-state-exit-hook #'fcitx--deactivate)
jiegec commented 8 years ago

好了,在这里。作者已经回复了。

Closes https://github.com/CodeFalling/fcitx-remote-for-osx/issues/17.

transtone commented 8 years ago

#'fcitx--deactivate 是什么语法,直接复制进 init.el 报错了。 run-hooks: Symbol’s function definition is void: fcitx--deactivate

(setq fcitx-active-evil-states nil) 这样设置似乎无效

transtone commented 8 years ago

好吧,我用回原来没用fcitx.el之前的设置了:

(defun close-fcitx ()
  (interactive)
  (save-excursion
    (let ((default-directory "/"))
      (shell-command "fcitx-remote -c"))))
(add-hook 'evil-normal-state-entry-hook 'close-fcitx)
cute-jumper commented 8 years ago

fcitx--deactivatefcitx.el 中定义的一个函数,但是没有 autoload,使用 (require 'fcitx) 或者 (autoload 'fcitx--deactivate "fcitx') 加载即可。

QiuMP commented 8 years ago

只要在自己的配置文件中重写其evil进入的函数即可 (defun fcitx--active-evil-states-entry () ()) 也可以在进入的时候强制关闭 (defun fcitx--active-evil-states-entry () (fcitx--evil-insert-maybe-deactivate))