When I use standard tab completion in bash or zsh, I type the first part of a filename or path, then hit to complete the word. This works well unless I'm in a directory full of files where all of the variation in filenames is at the end of the word, e.g. A directory full of time-stamped files which all start with the same prefix:
foo-20120701124501.log
foo-20120701124531.log
foo-20120701124601.log
foo-20120701124631.log
foo-20120701124701.log
foo-20120701124731.log
In this case, if I type foo<tab>
I'll get foo-20120701124
-- I can tab again, and see all of the files... I would have to type in the next 3 characters to get to a unique file name.
I'm wondering if there is a way to type for instance 4731.log
and then complete beginning of the word. I'm guessing that this would be difficult in bash, because bash completion uses $COMP_CWORD
and $COMP_KEY
for its programmable completion, and from the way that I'm reading it, I don't think that those would allow for leftward word completion. I don't know enough about completion inside zsh to know where to start looking in the man pages.