In Windows and Linux I could always hit ctrl+← or ctrl+→ to skip a word to the left or right in the terminal. In text editors it seems that ⌥+←/→ works, but no dice in the terminal. I've searched Google and found nothing except a Wikipedia page that claims ⌥+B/F does the job, but all it does is print ∫ and ƒ characters to my terminal (or ı and Ï if I hold ⇧). Any ideas?
|
You can use the ⌥ key, but you have to select the option to use it as the "meta" key:
Once you do that, ⌥+F and ⌥+B will work as you expect. |
|||||||||
|
|
if you know how to use vi you can also turn on vi line editing mode using
Once you get to the correct position, you can use the other vi commands to enter insert or append modes, or remove characters one by one, etc. |
|||||||||||||
|
|
As of Mac OS X Lion 10.7, Terminal maps ⌥-←/→ to esc+B/F by default, so this is now built-in for bash and other programs that use these emacs-compatible keybindings. |
||||
|
|
|
It seems that esc+B and esc+F are mapped by default to go to the beginning and end of words. Although, for my system you can't hold down esc but have to re-press it for each word. |
|||||
|
|
This was driving me crazy too, however I didn't want a Terminal-specific fix as I don't use Terminal, and being able to SSH into my OSX box had to use the correct keybindings too. Also, personally, I didn't care about the ⌥ key as discussed earlier; I wanted to maintain the ctrl+←/→ combination that I'm used to on Linux. To solve this problem, I added the following to my
Note the first two apply to bash in Terminal; the last two apply to bash in iTerm2 and incoming ssh connections. Don't ask me why the keyboard emulation is different ;) For the record, I was able to find what the keycodes actually were thanks to a hint from this stackoverflow answer: You can run (Note that for me, when I run BTW, if you want to see all active bash keybindings, run |
|||||
|
|
Open terminal, go to preferences, keyboard. On the list you'll find “ctrl cursor right” and “ctrl cursor left”. |
||||
|
|

