My dotfiles. Period.

menu-map.vim 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. "===========================================================================
  2. " $Id: menu-map.vim 520 2012-03-19 18:09:15Z luc.hermitte $
  3. " File: macros/menu-map.vim
  4. " Author: Luc Hermitte <EMAIL:hermitte {at} free {dot} fr>
  5. " <URL:http://code.google.com/p/lh-vim/>
  6. "
  7. " Purpose: Define functions to build mappings and menus at the same time
  8. "
  9. " License: GPLv3 with exceptions
  10. " <URL:http://code.google.com/p/lh-vim/wiki/License>
  11. " Version: 3.0.0
  12. " Last Update: $Date: 2012-03-19 19:09:15 +0100 (Mon, 19 Mar 2012) $ (02nd Dec 2006)
  13. "
  14. " Last Changes: {{{
  15. " Version 3.0.0:
  16. " GPLv3
  17. " Version 2.0.0:
  18. " Moved to vim7,
  19. " Functions moved to {rtp}/autoload/
  20. " Version 1.6.2:
  21. " (*) Silent mappings and menus
  22. " Version 1.6. :
  23. " (*) Uses has('gui_running') instead of has('gui') to check if
  24. " we can generate the menu.
  25. " Version 1.5. :
  26. " (*) visual mappings launched from select-mode don't end with
  27. " text still selected -- applied to :VCalls
  28. " Version 1.4. :
  29. " (*) address obfuscated for spammers
  30. " (*) support the local option
  31. " b:want_buffermenu_or_global_disable if we don't want
  32. " buffermenu to be used systematically.
  33. " 0 -> buffer menu not used
  34. " 1 -> buffer menu used
  35. " 2 -> the VimL developper will use a global disable.
  36. " cf.: tex-maps.vim:: s:SimpleMenu()
  37. " and texmenus.vim
  38. " Version 1.3. :
  39. " (*) add continuation lines support ; cf 'cpoptions'
  40. " Version 1.2. :
  41. " (*) Code folded.
  42. " (*) Take advantage of buffermenu.vim if present for local
  43. " menus.
  44. " (*) If non gui is available, the menus won't be defined
  45. " Version 1.1. :
  46. " (*) Bug corrected :
  47. " vnore(map\|menu) does not imply v+n(map\|menu) any more
  48. " }}}
  49. "
  50. " Inspired By: A function from Benji Fisher
  51. "
  52. " TODO: (*) no menu if no gui.
  53. "
  54. "===========================================================================
  55. if exists("g:loaded_menu_map") | finish | endif
  56. let g:loaded_menu_map = 1
  57. "" line continuation used here ??
  58. let s:cpo_save = &cpo
  59. set cpo&vim
  60. "=========================================================================
  61. " Commands {{{
  62. command! -nargs=+ -bang MAP map<bang> <args>
  63. command! -nargs=+ IMAP imap <args>
  64. command! -nargs=+ NMAP nmap <args>
  65. command! -nargs=+ CMAP cmap <args>
  66. command! -nargs=+ VMAP vmap <args>
  67. command! -nargs=+ AMAP
  68. \ call lh#menu#map_all('amap', <f-args>)
  69. command! -nargs=+ -bang NOREMAP noremap<bang> <args>
  70. command! -nargs=+ INOREMAP inoremap <args>
  71. command! -nargs=+ NNOREMAP nnoremap <args>
  72. command! -nargs=+ CNOREMAP cnoremap <args>
  73. command! -nargs=+ VNOREMAP vnoremap <args>
  74. command! -nargs=+ ANOREMAP
  75. \ call lh#menu#map_all('anoremap', <f-args>)
  76. " }}}
  77. " End !
  78. let &cpo = s:cpo_save
  79. finish
  80. "=========================================================================
  81. " vim600: set fdm=marker: