From e5b158fe757edc21e2c539fa4fd544a6fe04c554 Mon Sep 17 00:00:00 2001 From: Benji Fisher Date: Tue, 6 Dec 2011 09:33:21 -0500 Subject: [PATCH] Added modes argument, deleted root argument from s:CreateMenuItems(). --- plugin/NERD_commenter.vim | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/plugin/NERD_commenter.vim b/plugin/NERD_commenter.vim index 6cb7dbe..f881453 100644 --- a/plugin/NERD_commenter.vim +++ b/plugin/NERD_commenter.vim @@ -3,7 +3,7 @@ " Description: vim global plugin that provides easy code commenting " Maintainer: Martin Grenfell " Version: 2.3.0 -" Last Change: 08th December, 2010 +" Last Change: Tue Dec 06 09:00 AM 2011 Eastern Standard Time " License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You @@ -2785,31 +2785,32 @@ if g:NERDMenuMode != 0 let menuRoot = "" if g:NERDMenuMode == 1 - let menuRoot = 'comment' + let menuRoot = 'comment' elseif g:NERDMenuMode == 2 - let menuRoot = '&comment' + let menuRoot = '&comment' elseif g:NERDMenuMode == 3 - let menuRoot = '&Plugin.&comment' + let menuRoot = '&Plugin.&comment' endif - function! s:CreateMenuItems(target, desc, root) - exec 'nmenu ' . a:root . '.' . a:desc . ' ' . a:target - exec 'vmenu ' . a:root . '.' . a:desc . ' ' . a:target + function! s:CreateMenuItems(modes, target, desc) + for mode in split(a:modes, '\zs') + exec mode . 'menu ' . g:menuRoot . '.' . a:desc . ' ' . a:target + endfor endfunction - call s:CreateMenuItems("NERDCommenterComment", 'Comment', menuRoot) - call s:CreateMenuItems("NERDCommenterToggle", 'Toggle', menuRoot) - call s:CreateMenuItems('NERDCommenterMinimal', 'Minimal', menuRoot) - call s:CreateMenuItems('NERDCommenterNest', 'Nested', menuRoot) + call s:CreateMenuItems('nv', 'NERDCommenterComment', 'Comment') + call s:CreateMenuItems('nv', 'NERDCommenterToggle', 'Toggle') + call s:CreateMenuItems('nv', 'NERDCommenterMinimal', 'Minimal') + call s:CreateMenuItems('nv', 'NERDCommenterNest', 'Nested') exec 'nmenu '. menuRoot .'.To\ EOL NERDCommenterToEOL' - call s:CreateMenuItems('NERDCommenterInvert', 'Invert', menuRoot) - call s:CreateMenuItems('NERDCommenterSexy', 'Sexy', menuRoot) - call s:CreateMenuItems('NERDCommenterYank', 'Yank\ then\ comment', menuRoot) + call s:CreateMenuItems('nv', 'NERDCommenterInvert', 'Invert') + call s:CreateMenuItems('nv', 'NERDCommenterSexy', 'Sexy') + call s:CreateMenuItems('nv', 'NERDCommenterYank', 'Yank\ then\ comment') exec 'nmenu '. menuRoot .'.Append NERDCommenterAppend' exec 'menu '. menuRoot .'.-Sep- :' - call s:CreateMenuItems('NERDCommenterAlignLeft', 'Left\ aligned', menuRoot) - call s:CreateMenuItems('NERDCommenterAlignBoth', 'Left\ and\ right\ aligned', menuRoot) + call s:CreateMenuItems('nv', 'NERDCommenterAlignLeft', 'Left\ aligned') + call s:CreateMenuItems('nv', 'NERDCommenterAlignBoth', 'Left\ and\ right\ aligned') exec 'menu '. menuRoot .'.-Sep2- :' - call s:CreateMenuItems('NERDCommenterUncomment', 'Uncomment', menuRoot) + call s:CreateMenuItems('nv', 'NERDCommenterUncomment', 'Uncomment') exec 'nmenu '. menuRoot .'.Switch\ Delimiters NERDCommenterAltDelims' exec 'imenu '. menuRoot .'.Insert\ Comment\ Here NERDCommenterInInsert' exec 'menu '. menuRoot .'.-Sep3- :'