mirror of
https://github.com/preservim/nerdcommenter.git
synced 2025-11-10 10:43:48 -05:00
Replaced global variable menuRoot with a function-local variable.
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
" Description: vim global plugin that provides easy code commenting
|
" Description: vim global plugin that provides easy code commenting
|
||||||
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||||
" Version: 2.3.0
|
" Version: 2.3.0
|
||||||
" Last Change: Tue Dec 06 09:00 AM 2011 Eastern Standard Time
|
" Last Change: Tue Dec 06 10:00 AM 2011 Eastern Standard Time
|
||||||
" License: This program is free software. It comes without any warranty,
|
" License: This program is free software. It comes without any warranty,
|
||||||
" to the extent permitted by applicable law. You can redistribute
|
" 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
|
" it and/or modify it under the terms of the Do What The Fuck You
|
||||||
@@ -2783,19 +2783,13 @@ endif
|
|||||||
"check if the user wants the menu to be displayed
|
"check if the user wants the menu to be displayed
|
||||||
if g:NERDMenuMode != 0
|
if g:NERDMenuMode != 0
|
||||||
|
|
||||||
let menuRoot = ""
|
|
||||||
if g:NERDMenuMode == 1
|
|
||||||
let menuRoot = 'comment'
|
|
||||||
elseif g:NERDMenuMode == 2
|
|
||||||
let menuRoot = '&comment'
|
|
||||||
elseif g:NERDMenuMode == 3
|
|
||||||
let menuRoot = '&Plugin.&comment'
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! s:CreateMenuItems(modes, target, desc)
|
function! s:CreateMenuItems(modes, target, desc)
|
||||||
|
let menuRoot = get(['', 'comment', '&comment', '&Plugin.&comment'],
|
||||||
|
\ g:NERDMenuMode, '')
|
||||||
|
let command = 'menu <silent> ' . menuRoot . '.'
|
||||||
let modes = (a:modes == '') ? [''] : split(a:modes, '\zs')
|
let modes = (a:modes == '') ? [''] : split(a:modes, '\zs')
|
||||||
for mode in modes
|
for mode in modes
|
||||||
exec mode . 'menu <silent> ' . g:menuRoot . '.' . a:desc . ' ' . a:target
|
exec mode . command . a:desc . ' ' . a:target
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
call s:CreateMenuItems('nv', '<plug>NERDCommenterComment', 'Comment')
|
call s:CreateMenuItems('nv', '<plug>NERDCommenterComment', 'Comment')
|
||||||
|
|||||||
Reference in New Issue
Block a user