Ches Martin avatar Ches Martin committed 27abc43

vim: zomg my function key mappings work in console vim!!!1!

Comments (0)

Files changed (1)

   nnoremap <Leader>ql :write<CR>:sil !qlmanage -p % >& /dev/null &<CR>:redraw!<CR>
   nnoremap <Leader>qlk :sil !killall qlmanage >& /dev/null<CR>
 endif
+
+" Gross, but I'm tired of trying to get various terminal emulators to emit
+" consistent fucking escape sequences. These, for now, are whatever iTerm2 in
+" xterm-256color mode emits for function keys...
+"
+" http://stackoverflow.com/questions/3519532/mapping-function-keys-in-vim
+" http://stackoverflow.com/questions/9950944/binding-special-keys-as-vim-shortcuts
+if has('mac') && ($TERM == 'xterm-256color' || $TERM == 'screen-256color')
+  if has('autocmd')
+    augroup TermYakShaving
+      autocmd!
+      map <Esc>OP <F1>
+      map <Esc>OQ <F2>
+      map <Esc>OR <F3>
+      map <Esc>OS <F4>
+      map <Esc>[16~ <F5>
+      map <Esc>[17~ <F6>
+      map <Esc>[18~ <F7>
+      map <Esc>[19~ <F8>
+      map <Esc>[20~ <F9>
+      map <Esc>[21~ <F10>
+      map <Esc>[23~ <F11>
+      map <Esc>[24~ <F12>
+    augroup END
+  endif
+endif
 "}}}
 
 " Lotsa TextMate-inspired Mappings
-source ~/.vim/include/textmate-mappings.vim
+runtime include/textmate-mappings.vim
 
 " Language- and plugin-specific Preferences {{{1
 if has("autocmd")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.