Closed sincebyte closed 4 years ago
In the Go-Translate buffer, type C-h k q
to see what command q
bound to.
It is possible that some of your settings override the local-map
in the buffer.
C-h k q the result is blew: evil-record-macro is an interactive and compiled function defined in evil-commands.el. Signature (evil-record-macro REGISTER)
Note: On macbook key q is ok,but on ubuntu the key q do not work
It seems that evil
overwrites the local-map. I don't used evil
, but you can choose to disable it in the Go-translate buffer.
For example:
(add-hook 'go-translate-after-render-hook
(defun your-hook-that-disable-evil-mode-in-go-translate-buffer (&rest _)
(turn-off-evil-mode -1)))
Is there a configuration compatible with evil?
Not yet. The keybinds in Go-Translate may conflict with Evil
, you'd better customize the keys yourself according to the needs.
got it.
It seems go-translate-after-render-hook
was changed in v2 to gts-after-buffer-render-hook
/ gts-after-buffer-multiple-render-hook
.
If there is a newbie like me who is looking for an up-to-date example of configuration for doom-emacs, here is:
;; go-translate: https://github.com/lorniu/go-translate
(after! go-translate
(setq gts-translate-list '(("en" "ru")))
(setq gts-default-translator
(gts-translator
:picker (gts-prompt-picker)
:engines (list (gts-google-engine))
:render (gts-buffer-render)))
;; disable the evil mode to allow plugin keybindings: https://github.com/lorniu/go-translate/issues/6#issuecomment-700038291
(add-hook 'gts-after-buffer-render-hook ;; use 'gts-after-buffer-multiple-render-hook instead if you have multiple engines
(defun your-hook-that-disable-evil-mode-in-go-translate-buffer (&rest _)
(turn-off-evil-mode -1)))
(map! :leader :desc "Translate" :n "b T" #'gts-do-translate)
)
with doom this config is better
(map! :after go-translate
:map evil-normal-state-map
"q" nil)
(after! go-translate
(setq gts-translate-list '(("en" "zh")))
(setq gts-default-translator
(gts-translator
:picker (gts-prompt-picker)
:engines (list (gts-google-engine))
:render (gts-buffer-render)))
:map gts-buffer-local-map "q" #'+popup/quit-window)
In Go Translate buffer the key q do not work! Other key neighter