[vim] 01/01: debian.vim: Add MapExists() to check for map in multiple modes
James McCoy
jamessan at debian.org
Mon Dec 4 01:22:57 UTC 2017
This is an automated email from the git hooks/post-receive script.
jamessan pushed a commit to branch debian/sid
in repository vim.
commit b96027ebf1945f35a4af54ee2d665029da777d35
Author: James McCoy <jamessan at debian.org>
Date: Sun Dec 3 19:27:34 2017 -0500
debian.vim: Add MapExists() to check for map in multiple modes
maparg() only understands a single letter for the {mode} argument, so
this was incorrectly overriding existing mappings.
Signed-off-by: James McCoy <jamessan at debian.org>
---
debian/changelog | 9 +++++++++
debian/runtime/debian.vim.in | 13 +++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index ccbe842..1beb8f1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+vim (2:8.0.1257-3) UNRELEASED; urgency=medium
+
+ * runtime/debian.vim:
+ + Fix mechanism used to check for <S-Insert> mappings, since maparg()
+ doesn't understand multiple modes in the {mode} argument. Thanks to
+ Sergey Vlasov for the patch! (Closes: #883422)
+
+ -- James McCoy <jamessan at debian.org> Sun, 03 Dec 2017 19:25:24 -0500
+
vim (2:8.0.1257-2) unstable; urgency=medium
* Add patch to fix flakiness in test_search.vim
diff --git a/debian/runtime/debian.vim.in b/debian/runtime/debian.vim.in
index ad1bc74..5806cff 100644
--- a/debian/runtime/debian.vim.in
+++ b/debian/runtime/debian.vim.in
@@ -26,12 +26,21 @@ if &term =~ "xterm-debian" || &term =~ "xterm-xfree86"
set t_Sb=[4%dm
endif
+function! <SID>MapExists(name, modes)
+ for mode in split(a:modes, '\zs')
+ if !empty(maparg(a:name, mode))
+ return 1
+ endif
+ endfor
+ return 0
+endfunction
+
" Some Debian-specific things
if has("autocmd")
if has('gui')
" Make shift-insert work like in Xterm
- autocmd GUIEnter * if empty(maparg("<S-Insert>", "nvso")) | execute "map <S-Insert> <MiddleMouse>" | endif
- autocmd GUIEnter * if empty(maparg("<S-Insert>", "ic")) | execute "map! <S-Insert> <MiddleMouse>" | endif
+ autocmd GUIEnter * if !<SID>MapExists("<S-Insert>", "nvso") | execute "map <S-Insert> <MiddleMouse>" | endif
+ autocmd GUIEnter * if !<SID>MapExists("<S-Insert>", "ic") | execute "map! <S-Insert> <MiddleMouse>" | endif
endif
endif
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vim/vim.git
More information about the pkg-vim-maintainers
mailing list