macOS – How to Make HOME or END Keys Work in mc Running on OS X via SSH

keyboardmacosssh

I installed MacPorts on OS X 10.5 and I found out that when I connect to the computer using SSH and use mc – Midnight Commander – the HOME and END keys do not work.

I have to mention that I'm using putty and I am able to use the keyboard very well on Linux machines like Fedora, Ubuntu,…

Here is putty keyboard configuration (a configuration I found to be optimal over time):

  • Backspace key: 127
  • Home/End keys: Standard
  • Function keys: Xterm R6
  • Cursor keys: Normal
  • Numpad: normal
  • Terminal type string: xterm-color

I'm looking for a command line solution/script that does these changes, this make much easier to create a prepare OS script for configuring a new OS.

Best Answer

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

Related Question