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

Re: Separate cdpath elements in path-directories completion

[ moving to -workers and cc: Sebastian ]

Sebastian Stark wrote:
> Thanks for showing me the right direction. I ended up with the 
> following, in case somebody wants that feature too. I can control the 
> behaviour by adding
>    "zstyle ':completion:*:directories' cdpath-sections true"
> to my config.

I realise that you posted this "in case somebody wants that feature
too" rather than as an explicit contribution but if we include this in
the distributed _cd, it'd be rather easier to use. For that, there's a
couple of changes I would suggest:

cd completion otherwise uses the tag "path-directories" for directories
from $CDPATH. It is always better if you can vary the context but reuse
an existing style name. In this case, the separate-sections style would
be appropriate. This would then need to be:

  zstyle ':completion:*:path-directories' separate-sections true

Also, I would probably suggest expanding the description to "directory
in $elem" instead of just "$elem" as here:

> +        alt+=( "path-directories-$elem:$elem:_path_files -W $elem -/" )
> +      done
> +    else
> +      (( $#tmpcdpath )) &&
> +        alt=( 'path-directories:directory in cdpath:_path_files -W tmpcdpath -/' )

I'm also unsure about including $elem in the tag. It will probably work
fine but doesn't exactly conform with usual tag naming conventions.
Perhaps just an index for the position in the cdpath array. Does anyone
else have an opinion on that?


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