On a related note, when you want to insert something at the start of a line in a shell, rather than hitting home, I find ctrl-a to be very useful. Especially on a macbook, where cmd-left doesn't work in a shell (for some reason) and there is no home key.
This often works in unexpected places. For example: testing it right now, I can click the address bar on google chrome, hit ctrl-a (not cmd-a) and the caret is at the start of the url.
ctrl-a (beginning of line), ctrl-e (end of line), ctrl-k (kill/copy line), ctrl-y (yank/paste line) are standard emacs keybindings. On OS X, they work in any standard NS text field as well. More at http://www.hcs.harvard.edu/~jrus/site/cocoa-text.html
BTW, when using screen, ctrl-a is its default action key, so use ctrl-a ctrl-a to send a real ctrl-a, or change the default screen action key in your .screenrc.
> BTW, when using screen, ctrl-a is its default action key
This ends up annoying me on a regular basis. Let's say I want to make a directory and then go to it. I would type:
mkdir foo<Ctrl-p><Ctrl-a><Alt-d>cd<Enter>
Except when using screen, <Ctrl-a><Alt-d> (really just <Ctrl-a>d) detaches the session. It's solved easily enough ("screen -r"), but it always yanks me out of my groove.
I prefer to bind it to ` with `` to send a real `. It makes it really easy to flip back and forth between two screen windows since last-window is now:
`q
Now I don't even have to use Ctrl. This takes a little getting used to, but I prefer to use $() instead of `` for shell scripts (I use bash/zsh) so I don't make use of ` that often.
I do have bindings on F11 and F12 to toggle the escape character between ` and C-o. (Just in case I need to paste something into a terminal with ` characters.)
(Note: This whole setup is ripped off from some StackOverflow or HN post.)
Another one to add to the list, when working in the shell, is ctrl-u. This sort of does the opposite of ctrl-k and clears everything from your cursor to the start of the line. I use it when I recursive-search then change my mind, or when I screw up a password when ssh'ing.
It's my understanding that these keycombo's are originally from the readline library. Other programs that have these combo's available are irrsi and bash but I love to know more!
Your MacBook does have a home key, it's just not labelled any more. fn+left arrow is home, and end is the obvious counterpart. fn+up/down are page up/down too.
I use ctrl-a and ctrl-e too, but sometimes you're using remote desktop (or synergy) with a Windows machine...
This often works in unexpected places. For example: testing it right now, I can click the address bar on google chrome, hit ctrl-a (not cmd-a) and the caret is at the start of the url.