From 83449bf7e30d45f91eccbcdffd56abb126be56c1 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 18 Jul 2015 21:59:50 -0400 Subject: autoload/auditory.vim: Only map with `` if using `execute` We don't need to use `` in our mappings if we're going back to a regular non-command mode command, so listen for commands where we `execute` in the mapping and don't `` them. Reverted the ternary I had added previously to make this workable with the now 2 variables that need to listen for `execute`. Also add some line wrapping to the map creation for better readability. --- autoload/auditory.vim | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'autoload') diff --git a/autoload/auditory.vim b/autoload/auditory.vim index 000498c..22a7cd1 100644 --- a/autoload/auditory.vim +++ b/autoload/auditory.vim @@ -435,9 +435,17 @@ let s:mappings[''] = { function! auditory#AssignNormalModeMappings() for [key, value] in items(s:mappings) - " If this an `execute` mapping, add a pipe - let l:pipe = match(value.map_to, 'exec') !=# -1 ? ' \| ' : '' + let l:pipe = '' + let l:silence = '' - execute 'nmap ' . key . ' :call auditory#Play("' . value.audio . '")' . l:pipe . value.map_to + " If this an `execute` mapping + if match(value.map_to, 'exec') !=# -1 + let l:pipe = ' \| ' + let l:silence = '' + endif + + execute 'nmap ' . l:silence . ' ' . key . + \ ' :call auditory#Play("' . value.audio . '")' . + \ l:pipe . value.map_to endfor endfunction -- cgit v1.2.3