5

I'm trying to setup some keybinds using functions from the python-x package. While it works for the simple call (global-set-key (kbd "C-c C-j") 'python-shell-send-line), when I try to chain multiple functions using the lambda trick I get <C-return> is undefined despite having no error at startup. Here is the command I put in the user-config in .spacemacs :

(global-set-key (kbd "C-RET") (lambda () (interactive) (python-shell-send-line) (next-line)))

python-x works with python mode but the simple keybind is available everywhere while the chained keybinds are all undefined. Where does it go wrong ?

ChiseledAbs
  • 449
  • 1
  • 4
  • 13

1 Answers1

7

(kbd "C-RET") does not actually refer to "Control return", the way it looks like it will.

To find out how a key should be written, press C-h c and then the key. If we do that, we get:

<C-return> is undefined

So, use C-<return>:

(global-set-key (kbd "C-<return>") (lambda () (interactive) (python-shell-send-line) (next-line)))
zck
  • 9,092
  • 2
  • 33
  • 65