tpope / vim-vinegar

vinegar.vim: Combine with netrw to create a delicious salad dressing
https://www.vim.org/scripts/script.php?script_id=5671
2.22k stars 87 forks source link

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

Open mg979 opened 5 years ago

mg979 commented 5 years ago

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.

tpope commented 5 years ago

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

mg979 commented 5 years ago

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

tpope commented 5 years ago

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

mg979 commented 5 years ago

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

tpope commented 5 years ago

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

mg979 commented 5 years ago

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