aboutsummaryrefslogtreecommitdiffstats
path: root/autoload
diff options
context:
space:
mode:
authorTeddy Wing2015-08-16 02:08:13 -0400
committerTeddy Wing2015-08-16 02:17:54 -0400
commitd5b7bd6857e82fd2b164d41b929426394dcbf10e (patch)
tree00328234065e367ca5e4a53af6d0a7a72eaaff01 /autoload
parent099eb5c4209c7db737e3cf76b616fea98ca78a3e (diff)
downloadauditory.vim-d5b7bd6857e82fd2b164d41b929426394dcbf10e.tar.bz2
autoload/auditory.vim: Allow unmapping of non-normal mode commands
Add support for unmapping a map from any mode where it was defined, not just normal mode mappings from `auditory#Unmap()`.
Diffstat (limited to 'autoload')
-rw-r--r--autoload/auditory.vim5
1 files changed, 2 insertions, 3 deletions
diff --git a/autoload/auditory.vim b/autoload/auditory.vim
index 3e09a90..042c48b 100644
--- a/autoload/auditory.vim
+++ b/autoload/auditory.vim
@@ -509,11 +509,10 @@ endfunction
function! auditory#Unmap()
for [key, value] in items(s:mappings)
let l:cmd = has_key(value, 'map_command') ? value.map_command : 'nnoremap'
+ let l:key = has_key(value, 'map_from') ? value.map_from : key
let l:user_mapping = get(value, 'user_mapping', '')
- if l:cmd ==# 'nnoremap'
- execute 'nunmap ' . key
- endif
+ execute l:cmd[0] . 'unmap ' . l:key
if l:user_mapping !=# ''
execute l:cmd . ' ' . get(value, 'map_from', key) . ' ' . value.user_mapping