From 2fa35fb4949f670f1c137dc26a779f6e0515b330 Mon Sep 17 00:00:00 2001 From: Josh Hoff Date: Thu, 25 Apr 2013 21:34:36 -0500 Subject: [PATCH] don't redefine user-defined mappings As a user it's a little jarring when a plugin maps over something I've already defined. This patch fixes that problem, by using `` to ensure unique mappings. For more info see `:help ` Note: This has no effect if the mapping isn't already defined (that is, NERDTree is defining a unique mapping), so this won't break for normal users of the plugin. Note: `:silent!` is needed to ignore the error that occurs when a mapping is already defined. Fixes #252 --- lib/nerdtree/key_map.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nerdtree/key_map.vim b/lib/nerdtree/key_map.vim index 8645765..6066275 100644 --- a/lib/nerdtree/key_map.vim +++ b/lib/nerdtree/key_map.vim @@ -44,7 +44,7 @@ function! s:KeyMap.bind() let premap = self.key == "" ? " " : " " - exec 'nnoremap '. self.key . premap . ':call nerdtree#invokeKeyMap("'. keymapInvokeString .'")' + exec 'silent! nnoremap '. self.key . premap . ':call nerdtree#invokeKeyMap("'. keymapInvokeString .'")' endfunction "FUNCTION: KeyMap.Remove(key, scope) {{{1