Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Define key-bindings in emacs

I'd like to map a command in emacs to a key-binding. I want the command Control-l to have the same effect as the command Alt-x goto-line followed by a return (since that command first needs a return to be invoked and then a line number).

I modified the init file as follows:

(define-key (M-x goto-line) '\C-l)

but that didn't work. The error was that define-key was being given more than 1 arguments.

Does anyone know how to reset key-bindings in emacs?

Thanks!

like image 811
efficiencyIsBliss Avatar asked Dec 01 '22 07:12

efficiencyIsBliss


1 Answers

M-g g is the default shortcut for goto-line. You might want to try that.

To redefine C-l use:

(global-set-key (kbd "C-l") 'goto-line)
like image 107
carrutherji Avatar answered Dec 06 '22 22:12

carrutherji