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?

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.

  • And? What did you conclude? I knew it was sees CRTL+RET as just RET. Simple way to test it is C-h k C-RET and you will see it shows help for RET. My question was how to fix this problem. – Raghu Oct 22 '12 at 10:29
  • Sorry, looks like I misread your question and so I didn't really answer it. – verdammelt Oct 22 '12 at 11:29

You should be able to map the CTRL-RET to anything you want by making a Profile. Editing the Profile. In the Profile dialog box use the Keys tab to edit the sequence that gets sent when you press the keys.

I am not sure what sequence you need to send.

Hope this helps.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.