Not a duplicate:
I'm not looking for a way to complete directory names or execute scripts from a fixed directory. The issue I'm trying to solve is to get completion for the current directory without pressing /
I want zsh to tab-complete . to ./ like bash.
With bash I'm used to press .TABTAB to see all files in the current working directory since it first completes to ./ and then shows all content in that directory. Reason for my desire to avoid / at all cost is that / is way harder on my german keyboard than TAB since it's either with 2 fingers with shift or far away on numpad and I'd rather switch back to bash than type a /. What I'd like to achieve, in other words what bash does:
$ . <TAB> $ ./ <TAB> foo.sh somedir/ $ ./ <F><TAB> $ ./foo.sh <ENTER> Using zsh / oh-my-zsh when I hit .TAB I get . (dot space) which is not useful at all for me.
- Using
zstyle ':completion:*' special-dirs truewithsetopt auto_cd(which is oh-my-zsh default) gives me the even less useful option for../on top, so I turned that off already. I'm happy with completion ofcd. - There is no
.on$PATHand it should stay that way. Though I wouldn't mind completion of e.g.f<TAB>to./foo.shfor example.
How can I teach zsh to complete . to ./ or even better to local directory content right away? Or is there another way to work with local script files in an efficient way that does not involve /?
bashyou are gettingfoo.shas one if suggestion is because that's executable otherwise that is out. you can check the code of bash-completion to see what is does and maybe you can simulate the same in zsh./, it's that it doesn't get there from.- There's surely a simple regex rules one can put somewhere that triggers for exactly the string.?