[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] Request For New Feature: Unadorned Plus Sign
From: |
Paul Fox |
Subject: |
Re: [Nmh-workers] Request For New Feature: Unadorned Plus Sign |
Date: |
Fri, 10 Feb 2012 18:10:11 -0500 |
ralph wrote:
> Hi Norm,
>
> > Folder name completion was what I wanted for. I guess that it's not to
> > be.
>
> I did work out the tcsh(1) spell for that in another millenium, these
> days I use bash as it's what to hand. I've had a go at what you
> requested and it seems to work; I don't use it myself and haven't tried
> to define a bash completion before so be warned.
>
> comp_nmh_folder()
> {
> local w=${COMP_WORDS[COMP_CWORD]} &&
> [[ $w == +* ]] && w=${w#+} &&
> COMPREPLY=($(
> folders -fast |
> awk -v "w=$w" -v "l=${#w}" 'substr($0, 1, l) == w'
> ))
> }
> complete -P + -F comp_nmh_folder -D
>
> It assumes if you are completing a word starting with a plus that it's a
> folder. It does this for all commands, -D for default, not a hard-coded
> list of scan, refile, ... That way it works with your ~/bin. Tap Tab
> multiple times for a list of possible completions.
ralph is quickly becoming my new MH-tools hero. thanks!
(i've written my own version of the mh-reader-script-using-less trick
that ralph described the other day. when i've used it for a full day
without tweaking it, i'll share it here. no hard dependencies on my
own tools.)
paul
>
> Cheers, Ralph.
>
> _______________________________________________
> Nmh-workers mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/nmh-workers
=---------------------
paul fox, address@hidden (arlington, ma, where it's 38.3 degrees)