How to make HOME or END keys work in mc running on OS X (ssh)

The keyboard mappings for home and end in Terminal.app are not direct, but you can fix them. To get them to work directly, go to Terminal -> Preferences... -> Settings screen -> Keyboard and then find the lines for these keys and click the edit button for them (or add them if they are missing for some reason).

Be careful to not have any leading or trailing spaces as well for these.

home key code:

\033[H

end key code:

\033[F

page-up key code:

\033[5~

page-down key code:

\033[6~

Screenshot1

Screenshot2


The actual question was how to use Home and End keys with PuTTY when logged into OSX using ssh.

First, I changed the settings in the OSX Terminal.app preferences according to this link. It worked for me to fix Home and End keys for usage on desktop. However when logged into OSX remotely with PuTTY, Home and End keys still didn't work. So I modified PuTTY terminal as below:

Go to PuTTY configuration > Terminal > Keyboard
find "The function keys and keypad"
instead of
ESC[n~
choose
SCO
click Apply.

Your Home and End keys should work properly now on your PuTTY terminal when you are logged into OSX.

You can set and save different settings for your different sessions. When you login to other type machines you may use standard PuTTY setting.


Hold down the shift key for Home/End PgUp/Pg down in Terminal.app in order to not let Terminal use these keys for the scrollback. This way (with shift) Terminal will pass the keys on to the application running in the window.