Friday, July 4, 2008

Disable arrow keys in Emacs

So for this habit is ineradicable by will and my hands a little ache after hour or two of code surfing, I've decided just to disable this keys in my .emacs. Here we go:

(global-unset-key [(up)])
(global-unset-key [(down)])
(global-unset-key [(left)])
(global-unset-key [(right)])
(global-unset-key [(prior)])
(global-unset-key [(next)])
(global-unset-key [(home)])
(global-unset-key [(next)])

2 comments:

Derek said...

I don't have scroll bars, so these bindings are occasionally handy.

(global-set-key [up] (lambda () (interactive) (scroll-down 1)))
(global-set-key [down] (lambda () (interactive) (scroll-up 1)))
(global-set-key [left] (lambda () (interactive) (scroll-right tab-width t)))
(global-set-key [right] (lambda () (interactive) (scroll-left tab-width t)))

Martin said...

Try:
(mapcar 'global-unset-key '([(up)] [(down)]))

instead of repeating `(global-unset key...'