OS X uses emacs key binding my default. This is true is virtually every application on OS X, it's rather nice. It means things like C-a and C-e are beginning/end of line. You also get the nifty backward-word-kill with M-backspace, oh, and kill-line with C-k.
This should mean that in your terminal forward/backward-word are bound to M-f and M-b, respectively (M = Meta = alt/option), however that is not the case. On OS X forward/backword-word are bound to M-→ and M-← by default.
You can alter this behavior by changing how the GNU Readline Library is configured for your account. This takes place in your ~/.inputrc
file. You can get a big list of bindable commands with man readline
as well as in the online documentation like this here..
So to answer your question, you want to remap what Readline does when it sees C-→ and C-← to do what it does on your linux server.
The syntax for a ~/.inputrc
file is pretty simple for what you want to do: key-sequence: action
.
This should be what you need to get the desired behavior:
"\e[5C": forward-word
"\e[5D": backward-word
Here's another page with additional useful bindings.
(You could probably get away with copying /etc/inputrc from your linux box to your OS X ~/.inputrc)
Unfortunately, I can only offer workarounds...
You can deselect all messages e.g. by clicking the empty area if the list doesn't fill all vertical space, then press
ArrowUp
to select the last message
ArrowDown
to select the first message
To get the last message, press Cmd-A, Shift-ArrowUp, ArrowDown
.
If you don't use Mail's full screen mode, you can do the following:
Open Automator and create a new Service that receives no input in Mail. From the Utilities library, add a Run AppleScript action by double-clicking. Then use the following script code:
on run {input, parameters}
tell application "System Events"
tell application "System Events"
tell application process "Mail"
select first row of table 1 of scroll area 1 of first group of second splitter group of first splitter group of first window
end tell
end tell
end tell
end run
This script has been developed for the new three-column view. If you use the classic pre-Lion view, remove "of first group
" from that script.
Save as Select first row and assign a keyboard shortcut, e.g. Option-UpArrow
, in System Preferences » Keyboard » Keyboard Shortcuts » Services.
Create a new Service and repeat this, but replace first row
by last row
and name it Select last row.
These services will only be available in Mail, and select the first and last row respectively when you press the assigned keyboard shortcuts.
An alternative AppleScript, that works even in full screen mode and doesn't require the Accessibility API (UI scripting):
on run {input, parameters}
tell application "Mail" to set selected messages of first message viewer to last item of messages of first message viewer
end run
Replace last item
by first item
for the first list element. Again, create two Services and assign keyboard shortcuts.
If you are in threaded view, select View » Expand all Conversations first, as single messages that are part of a thread cannot be selected, and it cannot easily be determined which messages belong to a thread.
The alternative script below will select the bottom-most non-threaded message in the list, bounded by 50 attempts to not run forever:
on run {input, parameters}
tell application "Mail"
set cnt to number of items of messages of first message viewer
set lastitem to item cnt of messages of first message viewer
set selected messages of first message viewer to lastitem
set offst to 0
repeat while selected messages of first message viewer = missing value and offst is less than 50
set offst to offst + 1
set lastitem to item (cnt - offst) of messages of first message viewer
set selected messages of first message viewer to lastitem
end repeat
offst
end tell
end run
Best Answer
Type option-down arrow and keep it pressed for > 1s. The same goes for going to the top of the mail list, but type option-up arrow.