Mac – How to get Ctrl+return key binding for emacs in iTerm2 working

emacsitermkeyboard

I have Control+Return key bound to a function that I use very often. This works when i run emacs in x-windows. But when I run emacs in iTerm2 control+return just has the effect of line-feed (i.e as if I have just hit enter without holding the control key down). i have tried different variation of this in emacs

(global-set-key (kbd "<C-return>") 'duplicate-line)

(global-set-key (kbd "C-RET") 'duplicate-line)

(global-set-key [(control return)] 'duplicate-line)

None of them seem to work in iTerm/emacs. I'm not sure if this a emacs terminal mode problem or a problem with iTerm2. I don't want to bind this to any other complex key sequence as I use this very often.

How to get Ctrl+return key binding for emacs in iTerm2 working?

Best Answer

I just did a quick test of emacs in iTerm2 and Terminal. Both see CTRL-RET as simply RET.

I did this with CTRL-h k to see what the key is bound to.