Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A note to Mac users: Instead of Alt, you must press escape key. For example, Esc+b moves the cursor backward one word in bash, but you'll probably want to use option instead, so check 'Use option as meta key' in Terminal's settings (under keyboard tab).

But if it's not very handy, you can set 'option+left arrow' to move cursor one word backward. To do that, open Terminal's settings, go to keyboard and add a shortcut for left arrow (with 'option' as modifier), and leave the action to 'send string to shell'. Then click on the textbox below that and press esc (which should print '\033') and then 'b', or simply type '\033b' in the textbox.

Just this simple shortcut makes Mac's Terminal 1000 times better.



Thanks very, very much. I'm embarrassed to admit I probably spend 3-5 hours a day on a command line, and have just gotten used to set -o vi when I need to bounce around long lines a lot. esc+f/esc+b were always awkward. It should have occurred to me to just map the keys on Terminal.app!

In the interesting news department - Lion already has option left cursor/right cursor already mapped to move a word forward and back - not sure if it was there in snow leopard.


I am iTerm user so for those folks here is the setup you need to make "option" key the 'meta' key in iTerm

http://stackoverflow.com/questions/196357/making-iterm-to-tr...

I still don't like it since I am so used to hitting the Apple key in emacs, but it beats having to use Esc+<letter>


Totally agreed.

I also have 'option+right arrow' mapped to move cursor one word forward (use the same instructions as above, substituting 'f' for 'b').




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: