diff options
| author | Teddy Wing | 2015-08-02 23:54:47 -0400 |
|---|---|---|
| committer | Teddy Wing | 2015-08-02 23:54:47 -0400 |
| commit | 7306b5f6a5a8a1c9db8d9417f115e9f0d4c62f9e (patch) | |
| tree | 4259c038a16ff7e91e11d3804d8fd54ceec1c42c /autoload | |
| parent | c3af9fe7691ce2b4db2b6c876eebf7b06e2d6bb1 (diff) | |
| download | auditory.vim-7306b5f6a5a8a1c9db8d9417f115e9f0d4c62f9e.tar.bz2 | |
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.
Diffstat (limited to 'autoload')
| -rw-r--r-- | autoload/auditory.vim | 12 |
1 files 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 . "'<cr>" : |
