emacs-from-scratch icon indicating copy to clipboard operation
emacs-from-scratch copied to clipboard

local-set-key doesn't work anymore?

Open guoweis-work opened this issue 4 years ago • 1 comments

I use golang so i have some keybinding that i'm really used to. At the same time, I really like what you have here, this gives me a chance to understand how init.el works. But after applying what you have, I realized some of the most important keybinding in golang doesn't work for me anymore.

Even though I put this block back in the init.el, when I type "M-.", I still get "previous command was not evil-repeat: evil-forward-char"

How come the local-set-key doesn't take effect?

(defun my-go-mode-hook ()
; Call Gofmt before saving
(add-hook 'before-save-hook 'gofmt-before-save)
; Godef jump key binding
(local-set-key (kbd "M-.") 'godef-jump)
(local-set-key (kbd "M-*") 'pop-tag-mark)
)
(add-hook 'go-mode-hook 'my-go-mode-hook)

guoweis-work avatar Nov 12 '20 14:11 guoweis-work

Hi @guoweis-outreach! Since you're using evil-mode, you'll have to use (evil-local-set-key '(normal insert) (kbd "M-.") 'godef-jump) to bind the key in the local keymaps for the Evil states you want it in ('normal and 'insert in this case). Let me know if that works for you!

daviwil avatar Nov 12 '20 22:11 daviwil