Saturday 15 May 2010

Efficient Cursor Navigation while Coding



One of the reasons why most people like the trackpoint on those little IBM/lenovo notebooks is probably because you don't have to remove your hand from the "keyboard" area when you are typing something (or perhaps editing something too). Naturally, not having to move your hands from the keyboard area to the trackpad or mouse will save you a few seconds or may be minutes if you tend to sit at your computer for hours together.

However, recently after watching a talk by Richard Stallman about freedom (related to computer software that is) I remember his talk about the Church of Emacs. And finally, I decided to give emacs a try. I had never used it before (didn't really have to write all too much code), but after playing around with it for a several hours or so, I realized something really great: using the key combos to move your cursor around does increase your efficiency.

Here are some key combinations that will make your life a lot easier while using emacs or a mac (note, all of these combinations may not always work on a mac...)

Control + p = previous line
Control + n = next line
Control + f = forward one character
Control + b = back one character
Control + a = front of a line
Control + e = end of a line
Control + d = delete forward (because on most laptops/keyboards the delete button is usually further away from the backspace key)

While some people say that it might induce carpal tunnel syndrome, I for one think that pressing key combinations to move your cursor around, especially when you are coding can greatly improve your speed (until voice recognition becomes mainstream that is).

Try it, you'll be surprised how much you'll what to use these key combos elsewhere. Too bad on Windows some of these combinations are mapped to printing a file (which I don't do that often) or opening a new file.

What's more: These key combinations don't work only in emacs, they also work on macs! So now, whenever I am doing something, and need to go to the previous line or the next line, it just use the key combinations!




Got a question, tip or comment? Send them to beyondteck+question@gmail.com and we'll try to answer it in a blog post!

No comments:

Post a Comment