iTerm2 Home and End Buttons


Blog categories: 

After being somewhat unhappy with the Apple Terminal application since the very beginning, I found a very nice alternative in iTerm2! Everything seems to work fine from tabbing, splitting horizontally and vertically, cursor observation to fancy growl support.

The only pain were misconfigured Home and End keys. The approriate information on the iTerm2 homepage did not really give me the solution right out of the box, so I paste it here.

Make sure that your TERM variable is the same as set in your iTerm2 profile (in preferences) and add the following two esape sequences to your key configuration:

Button Escape Sequence
Home Esc + [1~
End Esc + [4~

It should work right after adding the sequences!
That’s it,



Home and End are a bit of a mess. If you’re using TERM=xterm-vt220 or xterm-r6 (and possible a few other values) then Esc+[1~ is correct. As far as I can tell the xterm terminfo uses the “PC-style” escape codes that iTerm2 ships with for the xterm, xterm-new, and xterm-256color TERMs. Not sure what ansi, vt100, rxvt, and linux are supposed to do. Which TERM are you using? FWIW, the xterm* terminal types are the most tested ones in iTerm2. If the others work, that actually kind of a coincidence at the moment :)

I’m using xterm-256color. vim has always been working with Home and End, but not my zsh. Maybe zsh is the reason? I recorded the key bindings in the Apple Terminal, also using zsh… Cheers, iss

hi i am new to this…. could you tell me how exactly i am to add the sequence….. if i type the esc + [`~ i don't really get the sequence but the las character typed…. could you please elaborate

I do the following:

  • open the Preferences
  • go to Keys tab
  • press '+' below
  • press e. g. the Home key to enable it as the keyboard shortcut
  • as action I choose Send Escape Sequence and
  • after Esc+ I add [1~

Maybe you did not set the correct action?