Hi list.

I wrote a patch to add mapadd(), mapdelete() functions,
which adds a new mapping, or deletes existing mapping.

https://gist.github.com/tyru/5460911
current revision:
https://gist.github.com/tyru/5460911/6ecfa0509c0679469d6843026ed08280ef1260c1
test script(it can't be placed in src/testdir/):
https://gist.github.com/tyru/5495267


Motivation:

* 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"):

function! s:test_add_alias()
    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'
    try
        let ret = mapadd(dict)
        let ok = ret ==# 0 && maparg('bar', 'n', 0) ==# 'rhs'
    catch | endtry
    " nmap foo
    return ok
endfunction


Tasks:

* 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?


Thanks

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui