Monday, February 06, 2012

MacOS home & end in the Terminal Window

See: http://fplanque.com/dev/mac/mac-osx-terminal-page-up-down-home-end-of-line#c18186


Alternatively, if this has problems, or is bash specific (doesn't work in tcsh) you can try this alternative solution:

Terminal->Preferences->[Settings]->[Keyboard]:

Find end, home, pg up, and pg down (the list is alphabetically sorted).

First double click 'end' and a prompt comes up that lets you remap the key, for 'Action' select 'send string to shell:' and then click on the entry field.

Press 'Esc' which emits '\033' then type '[4~' after it, so the text field should now show: "\033[4~". Click 'OK'.

Now you should be able to remap the other keys if you know the key codes, by pressing 'Esc' to emit \033. The codes for each of the keys are:

end \033[4~
home \033[1~
page down \033[6~
page up \033[5~

You will want to add 'Shift-pgdwn/pgup' to ask the buffer to scroll up and down. Do this by clicking '+' and adding 'pg down' with the 'Shift' modifier and then select 'scroll to next page in buffer', and do the opposite for pg up.

I believe this is the optimal fix.