1

I have a mapping set by a plugin that I want to unmap, which is the sequence "cop". The mapping is defined in unimpaired plugin: nnoremap cop <Nop>.

If I do

:map cop
n  cop         * <Nop>

So the mapping is there.

But I fail to detect it in my script (I don't want nunmap , because maparg("cop", "n") returns an empty string:

:echo empty(maparg("cop", "n"))
1

However, maparg("cop", "n", 0, 1) returns:

{'silent': 0, 'noremap': 1, 'lhs': 'cop', 'mode': 'n', 'nowait': 0, 'expr': 0, 'sid': 34, 'rhs': '<Nop>', 'buffer': 0}     

Why does the first maparg returns an empty string, and how to detect if the mapping is present?

(Vim 8.0.1453)

1
  • 4
    I could not reproduce this in Vim 8.1.1004. Might be fixed in between. Maybe this issue fixed by this commit. – Ralf Mar 15 '19 at 10:30
0

Thanks to @Ralf comment, upgrading to Vim 8.1 solved the issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.