How to turn off alternative Enter with Ctrl+M in Linux

前端 未结 8 847
广开言路
广开言路 2021-02-04 06:37

Why is Ctrl+M bound to Enter in Ubuntu Jaunty? How to turn it off?

I\'m using Emacs and would like to bind Ctrl+M to some other command.

8条回答
  •  温柔的废话
    2021-02-04 06:48

    input-decode-map does the trick. Quote from the emacs manual:

    This keymap has the same structure as other keymaps, but is used differently: it specifies translations to make while reading key sequences, rather than bindings for key sequences.

    It's the same principle like I've presented above, transforming Ctrl+m to something, say Ctrl+1 and map Ctrl+1 to your command. I use Ctrl+m for backward-kill-word.

    Here you go:

    (global-set-key (read-kbd-macro "C-1") 'backward-kill-word)
    (define-key input-decode-map "\C-m" [?\C-1])
    

提交回复
热议问题