Vim mappings not working in OS X I have the following lines in my .vimrc for Ubuntu. They insert the current date as a string, and insert my signature at the bottom of the currently open file, respectively:

:map &lt;F2&gt; "=strftime("%B %d, %Y")&lt;CR&gt;Pli&lt;Return&gt;&lt;Esc&gt;"
:map &lt;F3&gt; :e ~/.sign.txt&lt;CR&gt;ggV/^$&lt;CR&gt;k"*xG$a&lt;C-R&gt;&lt;C-O&gt;*&lt;Esc&gt;:w&lt;CR&gt;:bd&lt;CR&gt;G$a&lt;C-M&gt;&lt;Esc&gt;"*P


They're not working on my Macbook, though. The F2 command results in inserting "Q\n", and the F3 command results in inserting "R\n". How can I update these mappings to work on my Mac?
Put this in your .vimrc

" Mac specific fix for function keys
map &lt;Esc&gt;OP &lt;F1&gt;
map &lt;Esc&gt;OQ &lt;F2&gt;
map &lt;Esc&gt;OR &lt;F3&gt;
map &lt;Esc&gt;OS &lt;F4&gt;
map &lt;Esc&gt;[16~ &lt;F5&gt;
map &lt;Esc&gt;[17~ &lt;F6&gt;
map &lt;Esc&gt;[18~ &lt;F7&gt;
map &lt;Esc&gt;[19~ &lt;F8&gt;
map &lt;Esc&gt;[20~ &lt;F9&gt;
map &lt;Esc&gt;[21~ &lt;F10&gt;
map &lt;Esc&gt;[23~ &lt;F11&gt;
map &lt;Esc&gt;[24~ &lt;F12&gt;


From now on you can simply bind to &lt;F1&gt; for example