sinclairtarget / um

Create and maintain your own man pages so you can remember how to do stuff
MIT License
1.8k stars 42 forks source link

Invoke bashcompinit when using on zsh #7

Closed muraii closed 5 years ago

muraii commented 6 years ago

Hello!

Super utility here. I use zsh and the autocomplete relies on bash complete which is not enabled in zsh by default. Using bashcompinit makes complete available to zsh.

I just inserted a shell check into um-completion.sh and when it finds zsh it loads bashcompinit. This works on my systems but I will readily admit I just learned about bash completion and loading bashcompinit in the last hour or so, so I hope I've not introduced some stupid bug(s).

Cheers!

sinclairtarget commented 6 years ago

Cool! zsh support for auto-completion would be nice.

Is there a way to do that which is native to zsh? Your approach in this PR definitely does the trick, but autoload bashcompinit && bashcompinit feels like the kind of thing that should be in somebody's .bash_profile or whatever the zsh equivalent is.

Here is Git's zsh completion script. Maybe we could add one like it for um that gets copied to the right place on install?

muraii commented 6 years ago

You're right. I'll take a look at that and see if maybe I can contribute something a bit more elegant. it's a good excuse to bone up on shell scripting. :)

filipekiss commented 6 years ago

Hey @muraii! If you need help with that Zsh completion let me know. I've had my fair share of pain trying to write completion scripts :P

muraii commented 6 years ago

I may! I have no idea where to start nor what I'm doing. :) Which is to say that any progress will be very slow.

On Tue, Aug 28, 2018 at 8:02 AM Filipe Kiss notifications@github.com wrote:

Hey @muraii https://github.com/muraii! If you need help with that Zsh completion let me know. I've had my fair share of pain trying to write completion scripts :P

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sinclairtarget/um/pull/7#issuecomment-416558411, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYpmex6U7AZRUwuVtodUxkU6K5Tvzppks5uVTE5gaJpZM4WEYLe .

sinclairtarget commented 5 years ago

See https://github.com/sinclairtarget/um/pull/18