vim-vinegar icon indicating copy to clipboard operation
vim-vinegar copied to clipboard

Check if <plug> has been assigned with hasmapto()

Open mg979 opened this issue 7 years ago • 6 comments

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.

mg979 avatar Sep 06 '18 00:09 mg979

I think using mapcheck() would be the most appropriate solution here.

tpope avatar Sep 06 '18 07:09 tpope

As you prefer. So I should use mapcheck()? Should I add a note in the docs?

mg979 avatar Sep 06 '18 09:09 mg979

Yes replace empty(maparg()) with mapcheck(). Hopefully a note in the docs will be unnecessary.

tpope avatar Sep 06 '18 09:09 tpope

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

mg979 avatar Sep 06 '18 09:09 mg979

A boolean is returned from mapcheck() so you don't need empty(). I'm just going to go with the first commit for now.

tpope avatar Sep 10 '18 18:09 tpope

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

mg979 avatar Sep 11 '18 15:09 mg979