So I was typing away in an ssh window today when for the billionth time I had hit the END key expecting the cursor to jump to the end of the line, and it just printed a ~. As always, I just erased the character and then held down the arrow until I was at the end of the line. However, seeing as it was the billionth time I decided to figure out how to make it actually do what I want.
Not that I didn’t really know how to make it do what I want, I’ve just always been too lazy to actually look up the escape codes and such for the home and end keys, and then actually create the entries to fix it. So for the benefit of any other fellow lazy people, here’s what you need to do:
Create ~/.inputrc and put this in it:
That should cover most of the bases terminal-wise.
And to make sure that home/end work in Vi, this is what I added to .exrc:
map [CTRL-V] [HOME] ^
map [CTRL-V] [END] $
When I say [CTRL-V] I mean actually press the keys ctrl and v, not type that out, of course.
There are probably better ways to accomplish this, but this worked for me. Feel free to suggest a more elegant solution.