In bash when I try to use autocompletion in double-quoted strings it works:
E.g.
echo "My home directory is $HO<t>"
# expands to
echo "My home directory is $HOME"
But when I try the same thing in zsh it just does nothing.
At the same time it works outside strings:
echo My\ home\ directory\ is\ $HO<t>
# expands to
echo My\ home\ directory\ is\ $HOME
Is it possible to make it work the same as bash?
There are two possible reasons why this doesn't work for you:
.zshrc
file:
autoload -Uz compinit
compinit
bindkey '\t' complete-word
Without it, the Zsh line editor will simply expand the current expression on the line — and will try completion only if that doesn't do anything (which is why your second example does succeed)."
.As a workaround:
"
from your string before pressing Tab.