I am new to zsh
and recently moved on from csh
, due to obvious reasons.
Oddly enough, its taking me slightly longer than I expected to port a lot of aliases which I use extensively. Here's one of them.
In my csh i have a "cd test case" as follows
alias cdtc 'cd $TOP/\*/\*/tests/!*'
complete cdtc 'p#1#`/bin/ls -1 $TOP/*/*/tests | perl -lne '"'"'print if $_!~m/\// && $_!~m/^$/'"'"'`#'
I guess the complete command prints a neat little coloured list of options of all test cases in all tests folders in my hierarchy, when I press tab.
Partial matches are honoured. i.e.
$> cdtc type_a_ <tab>
would show directories beginning only withtype_a_
, but from all hierarchical locationsWhile I understand the alias, I don't completely understand that perl expression; but I do know it's mostly related to the list of directory names being pretty and not in a single column. Lack of complete grasp is because I did not compose the alias nor the completion command.
My expectation in zsh
I Expected that the complete command wouldn't be necessary and just the alias would do. I've come across a few online posts which discuss _path_files but I couldn't find anything like _path_dirs
.
I would like some pointers.