Lion: Map Option + arrow to home/end I am using the CLI version of Vim on Mac mini, with OS X Lion.

I use Vim as my main code editor, and one thing that bother me is lack of Home and End keys for moving to the Start and End of lines, respectively.
(On my laptop, the arrow keys left and right are home and end, with the Fn modifier)

I know Control + Arrows move screens, and Command + Arrows move through windows, so any way I can I can get Option or Fn + Arrows to do this?

I would really like something like this across all applications.

EDIT:

I answered this myself by basically following: theandystratton.com/2009/… I used the values supplied in the second comment too, which worked in both Vim and in general terminal too.

I wonder is there any drawbacks to using this...?
To remap home and end in Terminal, run f=~/Library/Preferences/com.apple.terminal.plist; plutil -convert xml1 $f; open $f -e, and change this:

&lt;key&gt;F729&lt;/key&gt;
&lt;string&gt;scrollToBeginningOfDocument:&lt;/string&gt;
&lt;key&gt;F72B&lt;/key&gt;
&lt;string&gt;scrollToEndOfDocument:&lt;/string&gt;


To this:

&lt;key&gt;F729&lt;/key&gt;
&lt;string&gt;&amp;#x1b;OH&lt;/string&gt;
&lt;key&gt;F72B&lt;/key&gt;
&lt;string&gt;&amp;#x1b;OF&lt;/string&gt;


To change them in normal text views, create ~/Library/KeyBindings/ and save a property list like this as DefaultKeyBinding.dict:

{
    "\UF729" = moveToBeginningOfParagraph:;
    "\UF72B" = moveToEndOfParagraph:;
    "$\UF729" = moveToBeginningOfParagraphAndModifySelection:;
    "$\UF72B" = moveToEndOfParagraphAndModifySelection:;
}


Another option would be to use KeyRemap4MacBook. See the "Use PC Style Home/End (except in Virtual Machine,RDC)" setting in https://raw.github.com/tekezo/KeyRemap4MacBook/master/Tests/lib/string/data/checkbox.xml.