Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Calling interactive command inside widget



This is a bit tangential to your bug, but I don't know if you know
about various run-help-CMD helper functions:

http://stackoverflow.com/questions/32293262/how-to-make-zsh-run-help-to-ignore-sudo-and-get-help-about-the-following-com

I just learned about these a month ago.

Cheers,

Frederick

On Wed, Apr 13, 2016 at 12:58:04AM +0300, Evgeny Zajcev wrote:
> I always had next widget in my zprofile
> 
>   my-run-help () {
>       words=(${=BUFFER})
>       if [[ $words[1] = sudo ]]
>       then
>           run-help $words[2]
>       else
>           run-help $words[1]
>       fi
>       zle reset-prompt
>   }
> 
>   zle -N my-run-help
>   bindkey "^[h" run-help
> 
> so when I type in prompt something like "sudo adduser xxx" and want
> interactive help on adduser I just press M-h
> 
> It was always working, however on my fresh Ubuntu install, I've got:
> 
>   adduser is /usr/sbin/adduser
>   Missing filename ("less --help" for help)
> 
> 
> I'v created simple widget like:
> 
>   just-run-man () {
>       man man
>   }
>   zle -N just-run-man
>   bindkey "^[h" just-run-man
> 
> And also got
> 
>   Missing filename ("less --help" for help)
> 
> What should I do to get desired behaviour?
> 
> I'm using zsh 5.0.2 (x86_64-pc-linux-gnu) under Ubuntu, my PAGER is less
> 
> thanks
> 
> -- 
> lg



Messages sorted by: Reverse Date, Date, Thread, Author