From bd079b8ff830f0c88c38f35c0fa0df34d10e89e1 Mon Sep 17 00:00:00 2001 From: Bob Hiestand Date: Tue, 15 May 2007 18:03:48 +0000 Subject: [PATCH] Added 'VCSCommandDisableMappings' and 'VCSCommandDisableExtensionMappings' options. These options prevent creation of all mappings, or only extension mappings, respectively. git-svn-id: https://vcscommand.googlecode.com/svn/trunk@54 e7462f97-9721-0410-a4e7-d7c98e439057 --- doc/vcscommand.txt | 13 ++++++ plugin/vcscommand.vim | 111 ++++++++++++++++++++++++++++---------------------- 2 files changed, 75 insertions(+), 49 deletions(-) diff --git a/doc/vcscommand.txt b/doc/vcscommand.txt index fce02c6..30113ce 100644 --- a/doc/vcscommand.txt +++ b/doc/vcscommand.txt @@ -400,6 +400,8 @@ The following variables are available: |VCSCommandCVSExec| |VCSCommandDeleteOnHide| |VCSCommandDiffSplit| +|VCSCommandDisableMappings| +|VCSCommandDisableExtensionMappings| |VCSCommandEdit| |VCSCommandEnableBufferSetup| |VCSCommandResultBufferNameExtension| @@ -437,6 +439,17 @@ VCSCommandDiffSplit *VCSCommandDiffSplit* This variable overrides the |VCSCommandSplit| variable, but only for buffers created with |:VCSVimDiff|. +VCSCommandDisableMappings *VCSCommandDisableMappings* + +This variable, if set to a non-zero value, prevents the default command +mappings from being set. This supercedes +|VCSCommandDisableExtensionMappings|. + +VCSCommandDisableExtensionMappings *VCSCommandDisableExtensionMappings* + +This variable, if set to a non-zero value, prevents the default command +mappings from being set for commands specific to an individual VCS. + VCSCommandEdit *VCSCommandEdit* This variable controls whether the original buffer is replaced ('edit') or diff --git a/plugin/vcscommand.vim b/plugin/vcscommand.vim index 8d88afc..6a69c60 100644 --- a/plugin/vcscommand.vim +++ b/plugin/vcscommand.vim @@ -2,7 +2,7 @@ " " Vim plugin to assist in working with files under control of CVS or SVN. " -" Version: Beta 17 +" Version: Beta 18 " Maintainer: Bob Hiestand " License: " Copyright (c) 2007 Bob Hiestand @@ -183,6 +183,14 @@ " This variable overrides the VCSCommandSplit variable, but only for buffers " created with VCSVimDiff. " +" VCSCommandDisableMappings +" This variable, if set to a non-zero value, prevents the default command +" mappings from being set. +" +" VCSCommandDisableExtensionMappings +" This variable, if set to a non-zero value, prevents the default command +" mappings from being set for commands specific to an individual VCS. +" " VCSCommandEdit " This variable controls whether to split the current window to display a " scratch buffer ('split'), or to display it in the current buffer ('edit'). @@ -891,7 +899,9 @@ function! VCSCommandRegisterModule(name, file, commandMap, mappingMap) let s:plugins[a:name] = a:commandMap call add(s:pluginFiles, a:file) let s:extendedMappings[a:name] = a:mappingMap - if(!empty(a:mappingMap)) + if !empty(a:mappingMap) + \ && !VCSCommandGetOption('VCSCommandDisableMappings', 0) + \ && !VCSCommandGetOption('VCSCommandDisableExtensionMappings', 0) for mapname in keys(a:mappingMap) execute 'noremap ' . mapname ':call ExecuteExtensionMapping(''' . mapname . ''')' endfor @@ -1100,53 +1110,56 @@ nnoremap VCSUpdate :VCSUpdate nnoremap VCSVimDiff :VCSVimDiff " Section: Default mappings {{{1 -if !hasmapto('VCSAdd') - nmap ca VCSAdd -endif -if !hasmapto('VCSAnnotate') - nmap cn VCSAnnotate -endif -if !hasmapto('VCSClearAndGotoOriginal') - nmap cG VCSClearAndGotoOriginal -endif -if !hasmapto('VCSCommit') - nmap cc VCSCommit -endif -if !hasmapto('VCSDelete') - nmap cD VCSDelete -endif -if !hasmapto('VCSDiff') - nmap cd VCSDiff -endif -if !hasmapto('VCSGotoOriginal') - nmap cg VCSGotoOriginal -endif -if !hasmapto('VCSInfo') - nmap ci VCSInfo -endif -if !hasmapto('VCSLock') - nmap cL VCSLock -endif -if !hasmapto('VCSLog') - nmap cl VCSLog -endif -if !hasmapto('VCSRevert') - nmap cq VCSRevert -endif -if !hasmapto('VCSReview') - nmap cr VCSReview -endif -if !hasmapto('VCSStatus') - nmap cs VCSStatus -endif -if !hasmapto('VCSUnlock') - nmap cU VCSUnlock -endif -if !hasmapto('VCSUpdate') - nmap cu VCSUpdate -endif -if !hasmapto('VCSVimDiff') - nmap cv VCSVimDiff + +if !VCSCommandGetOption('VCSCommandDisableMappings', 0) + if !hasmapto('VCSAdd') + nmap ca VCSAdd + endif + if !hasmapto('VCSAnnotate') + nmap cn VCSAnnotate + endif + if !hasmapto('VCSClearAndGotoOriginal') + nmap cG VCSClearAndGotoOriginal + endif + if !hasmapto('VCSCommit') + nmap cc VCSCommit + endif + if !hasmapto('VCSDelete') + nmap cD VCSDelete + endif + if !hasmapto('VCSDiff') + nmap cd VCSDiff + endif + if !hasmapto('VCSGotoOriginal') + nmap cg VCSGotoOriginal + endif + if !hasmapto('VCSInfo') + nmap ci VCSInfo + endif + if !hasmapto('VCSLock') + nmap cL VCSLock + endif + if !hasmapto('VCSLog') + nmap cl VCSLog + endif + if !hasmapto('VCSRevert') + nmap cq VCSRevert + endif + if !hasmapto('VCSReview') + nmap cr VCSReview + endif + if !hasmapto('VCSStatus') + nmap cs VCSStatus + endif + if !hasmapto('VCSUnlock') + nmap cU VCSUnlock + endif + if !hasmapto('VCSUpdate') + nmap cu VCSUpdate + endif + if !hasmapto('VCSVimDiff') + nmap cv VCSVimDiff + endif endif " Section: Menu items {{{1 -- 2.11.4.GIT