I wrote a patch to add mapadd(), mapdelete() functions,
which adds a new mapping, or deletes existing mapping.
test script(it can't be placed in src/testdir/):
* It is tough to implement vimscript function to add/delete a mapping
from Dictionary which is returned from maparg().
* need to care <expr> mapping too
* It is useful for "hiding" existing mapping to another lhs(to of
course even <SID> mapping), like this(from test script. it's creating
a mapping "bar" which is alias to a mapping "foo"):
let ok = 0
silent! nunmap <buffer> foo
silent! nunmap foo
silent! nunmap <buffer> bar
silent! nunmap bar
nnoremap foo rhs
let dict = maparg('foo', 'n', 0, 1)
let dict.lhs = 'bar'
let ret = mapadd(dict)
let ok = ret ==# 0 && maparg('bar', 'n', 0) ==# 'rhs'
catch | endtry
" nmap foo
* No tests in "src/testdir/" . but has a test script which I created
while debugging those two functions.
* Should check_secure() be called at the top of the function?
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@...
For more options, visit https://groups.google.com/groups/opt_out.