Fix home, end, pageup, pagedown keys in mac terminal vim

If you use vim in the mac terminal follow the steps below to regain use of these vital keys.

  1. Open Terminal.
  2. Open Preferences.
  3. Select Settings.
  4. Select your desired theme.
  5. Select Keyboard.
  6. Double click each key in title above.
  7. For each key set Action to ‘send string to shell:’ and set string as below.
    • Home: 33[7~
    • End: 33[4~
    • Page Up: 33[5~
    • Page Down: 33[6~

These will alter the key bindings not only in vim but in the terminal in general. If you want vim specific bindings another option is to use vim specific shortcuts. Personally, I prefer to use the above bindings and then in bash use ctrl-a for home and ctrl-e for end.

Did this tip help you? Let me know in the comments! [Credit]

4 thoughts on “Fix home, end, pageup, pagedown keys in mac terminal vim

  1. At least on my mb-pro retina, if you hold shift and fn together then use up/down, you get page up and down.

    For home and end, by default I have 33[H and 33[F so I changed these – works in vim, but not on the command line ):

  2. Is weird, I have tried this because it is suggested by everyone but on my MBpro Retina the page-up/page-down refuse to change. Only shift page up/down work.

  3. This post saved me a bunch of anguish! Worked perfectly, now I can FINALLY use my home and end keys properly without going insane on the mac terminal, Thanks much Dhruba !

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s