Replaced all :exec 'menu' lines with calls to s:CreateMenuItems().

This commit is contained in:
Benji Fisher 2011-12-06 09:56:48 -05:00
parent e5b158fe75
commit b141adda9e

View File

@ -2793,7 +2793,8 @@ if g:NERDMenuMode != 0
endif endif
function! s:CreateMenuItems(modes, target, desc) function! s:CreateMenuItems(modes, target, desc)
for mode in split(a:modes, '\zs') let modes = (a:modes == '') ? [''] : split(a:modes, '\zs')
for mode in modes
exec mode . 'menu <silent> ' . g:menuRoot . '.' . a:desc . ' ' . a:target exec mode . 'menu <silent> ' . g:menuRoot . '.' . a:desc . ' ' . a:target
endfor endfor
endfunction endfunction
@ -2801,19 +2802,19 @@ if g:NERDMenuMode != 0
call s:CreateMenuItems('nv', '<plug>NERDCommenterToggle', 'Toggle') call s:CreateMenuItems('nv', '<plug>NERDCommenterToggle', 'Toggle')
call s:CreateMenuItems('nv', '<plug>NERDCommenterMinimal', 'Minimal') call s:CreateMenuItems('nv', '<plug>NERDCommenterMinimal', 'Minimal')
call s:CreateMenuItems('nv', '<plug>NERDCommenterNest', 'Nested') call s:CreateMenuItems('nv', '<plug>NERDCommenterNest', 'Nested')
exec 'nmenu <silent> '. menuRoot .'.To\ EOL <plug>NERDCommenterToEOL' call s:CreateMenuItems('n', '<plug>NERDCommenterToEOL', 'To\ EOL')
call s:CreateMenuItems('nv', '<plug>NERDCommenterInvert', 'Invert') call s:CreateMenuItems('nv', '<plug>NERDCommenterInvert', 'Invert')
call s:CreateMenuItems('nv', '<plug>NERDCommenterSexy', 'Sexy') call s:CreateMenuItems('nv', '<plug>NERDCommenterSexy', 'Sexy')
call s:CreateMenuItems('nv', '<plug>NERDCommenterYank', 'Yank\ then\ comment') call s:CreateMenuItems('nv', '<plug>NERDCommenterYank', 'Yank\ then\ comment')
exec 'nmenu <silent> '. menuRoot .'.Append <plug>NERDCommenterAppend' call s:CreateMenuItems('n', '<plug>NERDCommenterAppend', 'Append')
exec 'menu <silent> '. menuRoot .'.-Sep- :' call s:CreateMenuItems('', ':', '-Sep-')
call s:CreateMenuItems('nv', '<plug>NERDCommenterAlignLeft', 'Left\ aligned') call s:CreateMenuItems('nv', '<plug>NERDCommenterAlignLeft', 'Left\ aligned')
call s:CreateMenuItems('nv', '<plug>NERDCommenterAlignBoth', 'Left\ and\ right\ aligned') call s:CreateMenuItems('nv', '<plug>NERDCommenterAlignBoth', 'Left\ and\ right\ aligned')
exec 'menu <silent> '. menuRoot .'.-Sep2- :' call s:CreateMenuItems('', ':', '-Sep2-')
call s:CreateMenuItems('nv', '<plug>NERDCommenterUncomment', 'Uncomment') call s:CreateMenuItems('nv', '<plug>NERDCommenterUncomment', 'Uncomment')
exec 'nmenu <silent> '. menuRoot .'.Switch\ Delimiters <plug>NERDCommenterAltDelims' call s:CreateMenuItems('n', '<plug>NERDCommenterAltDelims', 'Switch\ Delimiters')
exec 'imenu <silent> '. menuRoot .'.Insert\ Comment\ Here <plug>NERDCommenterInInsert' call s:CreateMenuItems('i', '<plug>NERDCommenterInInsert', 'Insert\ Comment\ Here')
exec 'menu <silent> '. menuRoot .'.-Sep3- :' call s:CreateMenuItems('', ':', '-Sep3-')
exec 'menu <silent>'. menuRoot .'.Help :help NERDCommenterContents<CR>' call s:CreateMenuItems('', ':help NERDCommenterContents<CR>', 'Help')
endif endif
" vim: set foldmethod=marker : " vim: set foldmethod=marker :