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

Alt-Arrows - is that a Lion thing? Opening up a stock iterm, and hitting...

hrm... well "alt" is above the 'option' label, so I'm not sure how to invoke that. option arrows don't move by word. fn+option (which I'd assume give me 'alt' mode) doesn't work. What's the magic invocation to make that happen? Or is it Lion only? (snow leopard here).



I’m sorry, the German keyboard confused me – there the option key is labeled alt. You can replace every Alt in my comment with Option.

I’m not sure whether that’s new (I think other shortcuts for moving from word to word were also already commented on around here) but when I fire up Terminal in Lion I can move from word to word by pressing Option-Arrow-left or Option-Arrow-right.


Hrm. Doesn't work here (US snow leopard MBP early 2011), and I'm pretty sure it's not worked on earlier versions.

Some other comments indicated "esc/b" and "esc/f", and those seem to work, but are horribly unintuitive and difficult to type. Will need to map them. I've lived X years without that ability, so another few minutes won't hurt :)

thx


iTerm != Terminal. The alt-arrows works in Lion's Terminal; I just checked (although I use iTerm, where it doesn't work). iTerm appears to be the only app that doesn't respond to ctrl/alt-arrows. I use them quite frequently, and it always trips me up that iTerm works differently than essentially every other app.


That's because alt-arrow isn't a ANSI control sequence. What should it map to? You can see what your terminal is sending with this command:

    stty -icanon -echo; od -c
Hit your key sequence then hit return a bunch of times until the line comes out. You'll see some sort of ESC sequence.

When done, control-c then type "stty sane" (it will not echo).

For iTerm I get "\e[1;9D". Terminal, interestingly is giving me "\e\eD". When I turn off my "Use option as meta key" preference in Terminal it gives me "\eD". Which is the same as plain left arrow.

Also, neither of those escape sequences does anything in bash for me.


You're right, in that they're not the same - I use the terms interchangeably sometimes and shouldn't. That said, my snow leaopard Terminal doesn't have those keystrokes working either. :/

I typically use iterm2 now, and I mapped option/left and option/right to ESC-b and ESC-f, and all is well for me. Hope that helps someone else.




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

Search: