Share Pastebin
Guest
Public paste!

Dick Moores

By: a guest | Aug 23rd, 2008 | Syntax: None | Size: 0.47 KB | Hits: 52 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. "From http://vim.wikia.com/wiki/Disable_F1_built-in_help_key
  2. inoremap <F1> <Esc>
  3. noremap <F1> :call SophHelp()<cr>
  4.  
  5. function! MapF1()
  6.   if buftype == "help"
  7.     exec 'quit'
  8.   else
  9.     exec 'help'
  10.   endif
  11. endfunction
  12.  
  13. function! SophHelp()
  14.   if &buftype=="help" && match( strpart( getline("."), col(".")-1,1), "\\S")<0
  15.     bw
  16.   else
  17.     try
  18.       exec "help ".expand("<cWORD>")
  19.     catch /:E149:/
  20.       exec "help ".expand("<cword>")
  21.     endtry
  22.   endif
  23. endfunc