aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--autoload/auditory.vim15
1 files changed, 15 insertions, 0 deletions
diff --git a/autoload/auditory.vim b/autoload/auditory.vim
index 915c561..0476631 100644
--- a/autoload/auditory.vim
+++ b/autoload/auditory.vim
@@ -463,3 +463,18 @@ function! auditory#AssignMappings()
\ l:pipe . value.map_to
endfor
endfunction
+
+
+" If users have a custom mapping for any of the commands we need, store the
+" mapping so we can map to it after playing audio and so we can restore the
+" user's mappings when the plugin is toggled off.
+function! auditory#StoreUserMappings()
+ for [key, value] in items(s:mappings)
+ let l:map_from = has_key(value, 'map_from') ? value.map_from : key
+ let l:user_mapping = maparg(l:map_from)
+
+ if l:user_mapping
+ let value.user_mapping = l:user_mapping
+ endif
+ endfor
+endfunction