From 7306b5f6a5a8a1c9db8d9417f115e9f0d4c62f9e Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 2 Aug 2015 23:54:47 -0400 Subject: autoload/auditory.vim: Correctly map to user mappings If a user has defined: nnoremap j gj then when you press `j` with Auditory turned on, it should make the sound and do `gj`. Previously it did `j` instead. Now it does `gj`. No more blatant disregard for user mappings. --- autoload/auditory.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/autoload/auditory.vim b/autoload/auditory.vim index ed2040c..b89daf8 100644 --- a/autoload/auditory.vim +++ b/autoload/auditory.vim @@ -430,8 +430,16 @@ function! auditory#AssignMappings() " If `map_from` is specified, we can't rely on `key` to provide it let l:map_from = has_key(value, 'map_from') ? value.map_from : key - " Map to the same key unless a `map_to` is defined - let l:map_to = has_key(value, 'map_to') ? value.map_to : key + " Map to key unless a `map_to` or user mapping is defined + if has_key(value, 'map_to') + let l:map_to = value.map_to + else + if has_key(value, 'user_mapping') + let l:map_to = value.user_mapping + else + let l:map_to = key + endif + endif let l:map_to_with_count = has_key(value, 'count') ? \ "execute 'normal!' v:count1 . '" . l:map_to . "'" : -- cgit v1.2.3