Learning emacs movement keys

One of the techniques I share in Emacs-fu is the post-it note technique. I originally found it in a PeepCode screencast, and I’ve been using it since then to learn new keyboard shortcuts. The idea is to write down the thing you’d like to learn on a post-it and keep it near your computer or on your laptop next to your keyboard.

I found it to work especially well with learning new things (say C-x r k for rectangle delete). Recently, I’ve been using it to learn the alternative navigation keys. The theory is that emacs has some shortcuts bound to cursor movement that replace the regular arrow keys and home / end / pgup / pgdn. The supposed advantage is that you don’t have to move your hands from their regular typing position to use these shortcuts, so I expect that I’ll get at least a small payoff if I can get them ingrained. Two weeks ago, I stuck a post-it with the shortcuts on my laptop, and since then my habits haven’t shifted much. I’ve used C-n and C-p occasionally, but not enough for it to become a long-term habit.

The problem is that I have an addiction to the arrow keys, and unlearning it is painful – it makes me think about editing when I’d rather be thinking about the code, which is frustrating. I tried blocking out ten minute segments where I’d only use the bindings, but I didn’t end up doing that very often. So I came up with an idea – how about I unbind the arrow keys? That way I’d be forced to learn the new keys. A few minutes later:

(global-set-key (kbd “<up>”) ‘ignore)
(global-set-key (kbd “<down>”) ‘ignore)
(global-set-key (kbd “<left>”) ‘ignore)
(global-set-key (kbd “<right>”) ‘ignore)
(global-set-key (kbd “C-<up>”) ‘ignore)
(global-set-key (kbd “C-<down>”) ‘ignore)
(global-set-key (kbd “C-<left>”) ‘ignore)
(global-set-key (kbd “C-<right>”) ‘ignore)
(global-set-key (kbd “<home>”) ‘ignore)
(global-set-key (kbd “<end>”) ‘ignore)

This feels like just the right amount of force to overcome the habit. If you’re super-determined, this will do the trick.

Hello hello! You can find a bunch more nifty emacs tricks in Emacs-fu. Launch imminent!

Pop your email down here. You’ll get more tips about emacs and access to an early copy of Emacs-fu with a discount:



Share and Enjoy:
  • Facebook
  • StumbleUpon
  • Twitter

Random readings...


     
     
     

    Leave a Reply

    CommentLuv Enabled