nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] Request For New Feature: Unadorned Plus Sign

2012-02-10 16:58:35
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.

Cheers, Ralph.

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>