From bb5d57afd9016705b1d7d6d9b707e5b70b4051ba Mon Sep 17 00:00:00 2001 From: Bob Hiestand Date: Thu, 2 Jun 2011 17:18:20 -0500 Subject: [PATCH] Respect 'no_plugin_maps'. --- plugin/vcscommand.vim | 39 +++++++++++++++++++++------------------ plugin/vcscvs.vim | 36 +++++++++++++++++++----------------- 2 files changed, 40 insertions(+), 35 deletions(-) diff --git a/plugin/vcscommand.vim b/plugin/vcscommand.vim index 748b72a..92884d9 100644 --- a/plugin/vcscommand.vim +++ b/plugin/vcscommand.vim @@ -1114,6 +1114,7 @@ endfunction function! VCSCommandRegisterModule(name, path, commandMap, mappingMap) let s:plugins[a:name] = [a:path, a:commandMap, a:mappingMap] if !empty(a:mappingMap) + \ && !exists("g:no_plugin_maps") \ && !VCSCommandGetOption('VCSCommandDisableMappings', 0) \ && !VCSCommandGetOption('VCSCommandDisableExtensionMappings', 0) for shortcut in keys(a:mappingMap) @@ -1321,23 +1322,25 @@ com! VCSCommandEnableBufferSetup call VCSCommandEnableBufferSetup() com! VCSReload let savedPlugins = s:plugins|let s:plugins = {}|call s:ClearMenu()|unlet! g:loaded_VCSCommand|runtime plugin/vcscommand.vim|for plugin in values(savedPlugins)|execute 'source' plugin[0]|endfor|unlet savedPlugins " Section: Plugin command mappings {{{1 -nnoremap VCSAdd :VCSAdd -nnoremap VCSAnnotate :VCSAnnotate -nnoremap VCSCommit :VCSCommit -nnoremap VCSDelete :VCSDelete -nnoremap VCSDiff :VCSDiff -nnoremap VCSGotoOriginal :VCSGotoOriginal -nnoremap VCSClearAndGotoOriginal :VCSGotoOriginal! -nnoremap VCSInfo :VCSInfo -nnoremap VCSLock :VCSLock -nnoremap VCSLog :VCSLog -nnoremap VCSRevert :VCSRevert -nnoremap VCSReview :VCSReview -nnoremap VCSSplitAnnotate :VCSAnnotate! -nnoremap VCSStatus :VCSStatus -nnoremap VCSUnlock :VCSUnlock -nnoremap VCSUpdate :VCSUpdate -nnoremap VCSVimDiff :VCSVimDiff +if !exists("no_plugin_maps") + nnoremap VCSAdd :VCSAdd + nnoremap VCSAnnotate :VCSAnnotate + nnoremap VCSCommit :VCSCommit + nnoremap VCSDelete :VCSDelete + nnoremap VCSDiff :VCSDiff + nnoremap VCSGotoOriginal :VCSGotoOriginal + nnoremap VCSClearAndGotoOriginal :VCSGotoOriginal! + nnoremap VCSInfo :VCSInfo + nnoremap VCSLock :VCSLock + nnoremap VCSLog :VCSLog + nnoremap VCSRevert :VCSRevert + nnoremap VCSReview :VCSReview + nnoremap VCSSplitAnnotate :VCSAnnotate! + nnoremap VCSStatus :VCSStatus + nnoremap VCSUnlock :VCSUnlock + nnoremap VCSUpdate :VCSUpdate + nnoremap VCSVimDiff :VCSVimDiff +endif " Section: Default mappings {{{1 @@ -1361,7 +1364,7 @@ let s:defaultMappings = [ \['v', 'VCSVimDiff'], \] -if !VCSCommandGetOption('VCSCommandDisableMappings', 0) +if !exists("g:no_plugin_maps") && !VCSCommandGetOption('VCSCommandDisableMappings', 0) for [s:shortcut, s:vcsFunction] in VCSCommandGetOption('VCSCommandMappings', s:defaultMappings) call s:CreateMapping(s:shortcut, '' . s:vcsFunction, '''' . s:vcsFunction . '''') endfor diff --git a/plugin/vcscvs.vim b/plugin/vcscvs.vim index 5244fda..53e6770 100644 --- a/plugin/vcscvs.vim +++ b/plugin/vcscvs.vim @@ -410,23 +410,25 @@ com! CVSWatchers call s:CVSWatchers() " Section: Plugin command mappings {{{1 let s:cvsExtensionMappings = {} -let mappingInfo = [ - \['CVSEdit', 'CVSEdit', 'e'], - \['CVSEditors', 'CVSEditors', 'E'], - \['CVSUnedit', 'CVSUnedit', 't'], - \['CVSWatchers', 'CVSWatchers', 'wv'], - \['CVSWatchAdd', 'CVSWatch add', 'wa'], - \['CVSWatchOff', 'CVSWatch off', 'wf'], - \['CVSWatchOn', 'CVSWatch on', 'wn'], - \['CVSWatchRemove', 'CVSWatch remove', 'wr'] - \] - -for [pluginName, commandText, shortCut] in mappingInfo - execute 'nnoremap ' . pluginName . ' :' . commandText . '' - if !hasmapto('' . pluginName) - let s:cvsExtensionMappings[shortCut] = commandText - endif -endfor +if !exists("no_plugin_maps") + let mappingInfo = [ + \['CVSEdit', 'CVSEdit', 'e'], + \['CVSEditors', 'CVSEditors', 'E'], + \['CVSUnedit', 'CVSUnedit', 't'], + \['CVSWatchers', 'CVSWatchers', 'wv'], + \['CVSWatchAdd', 'CVSWatch add', 'wa'], + \['CVSWatchOff', 'CVSWatch off', 'wf'], + \['CVSWatchOn', 'CVSWatch on', 'wn'], + \['CVSWatchRemove', 'CVSWatch remove', 'wr'] + \] + + for [pluginName, commandText, shortCut] in mappingInfo + execute 'nnoremap ' . pluginName . ' :' . commandText . '' + if !hasmapto('' . pluginName) + let s:cvsExtensionMappings[shortCut] = commandText + endif + endfor +endif " Section: Plugin Registration {{{1 let s:VCSCommandUtility = VCSCommandRegisterModule('CVS', expand(''), s:cvsFunctions, s:cvsExtensionMappings) -- 2.11.4.GIT