vim-vinegar
vim-vinegar copied to clipboard
Check if <plug> has been assigned with hasmapto()
Using - as a prefix for other mappings leads to often bring up vinegar when it shouldn't. Basically it's impossible to have - unmapped with the current setup.
I think using mapcheck() would be the most appropriate solution here.
As you prefer. So I should use mapcheck()? Should I add a note in the docs?
Yes replace empty(maparg()) with mapcheck(). Hopefully a note in the docs will be unnecessary.
First commit: only mapcheck()
Second commit: doc update
Third commit: checking both mapping and plugs, so that one can map a plug and leave - unmapped, if he really wants to. But maybe it's overdone.
You can drop the last two commits if you think it's unnecessary. Thanks
A boolean is returned from mapcheck() so you don't need empty(). I'm just going to go with the first commit for now.
Ok. You can consider this more an issue than a PR. Since you're there, you might consider to add a
nmap <buffer><nowait> - <Plug>VinegarUp
in s:setup_vinegar() so that - works in the netrw buffer, so that at least there it works as designed. I added it because if I have a reason to use -- outside of netrw, there's no reason not to use - inside of it. Thanks