Remove Default Emacs Mode Shortcuts

Sometimes you find that a mode grabs a shortcut you've already defined for something else, or that you want to override. This could be C-c shortcuts, which are supposed to be free for the end user to configure but some mode set anyway, or something else.

Today, I set up an LSP server for my Markdown files and discovered my code action shortcut M-RET didn't work, but instead inserted another Markdown list item. To remedy this, I did the following to remove it from the mode keymap in question:

(use-package markdown-mode
  :bind (:map markdown-mode-map ("M-RET" . nil)))

With that, using LSP servers in Markdown is just as smooth as in other modes. To remedy an LSP marked problem, I hit M-RET and Tab complete the action I want.

Happy writing!

PS:

If you're not using use-package, you can do:

(with-eval-after-load 'markdown-mode
  (keymap-unset markdown-mode-map "M-RET" t))

~ /home 🏠 ~ talks 💬 ~ bash ~ craftsmanship ~ db ~ dongxi ~ emacs ~ escenic ~ iam ~ identity ~ java ~ js ~ language ~ latex ~ ldap ~ life ~ linux ~ llm ~ mac-os-x ~ mt-foo ~ network ~ norsk ~ python ~ quotes ~ running ~ security ~ travel ~ unix ~ various ~ vcs ~ webdesign ~ windows ~ discoveries ~ cv 🧙 ~

Licensed under CC BY Creative Commons License ~ 📡 RSS feed ~ ✉ torstein.k.johansen @ gmail ~ 🐘 @skybert@hachyderm.io ~ 🎥 youtube.com/@skybert