Mac OSX vim terminal page up, page down, home, end working

in Terminal > File > Preferences
change the following keyboard settings:
Home: \033[4~
End: \033[1~
PageUp: \033[5~
PageDown: \033[6~

To write \033 just press ESC button, for [ it’s MAJ+alt+5 and finally for the ~ it’s alt+n

then do not forget to assign the default value to this particular settings format

update: or use iTerm

4 comments to Mac OSX vim terminal page up, page down, home, end working

  • Seb, what are you doing on Mac :o

  • Many thanks for the tip!

    It took me hours to fix the delete key in vimrc and hours to try to fix these keys to no avail. I’m posting a comment in the hope to give you a boost in the search rankings for others to find.

    FYI, I was able to just copy and paste these strings into the terminal prefs as it does not recognize apple-v as a character string.

    Also, these commands cause ~ on the local os x command line, but that’s no big deal compared to fixing them in vim and the command line of my remote server. What a bizarre, yet vital quirk to waste my time trying to fix!

  • Ward

    There is a typo. The home and end keyboard string should be swapped, so that it becomes:
    Home: 33[1~
    End: 33[4~
    (Thanks for the tip)

  • Matthew

    Very cool, but now home and end no longer work in readline’s vim mode (ie, in Bash). Pretty frustrating. I wish I didn’t have to choose between having home/end work in Bash or vim.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*