Closed GiselleSerate closed 6 years ago
An understanding of bash tab completions continues to elude me. There are three different systems I've encountered that all seem to do things differently: knuth, my phone, and my laptop. A little bit of a breakthrough came when I played around with cds tab completion a while back. I'll document a few things I learned for posterity. Hopefully they can shed some light on how normal alias gets its completions too.
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
/etc/bash_completion.d/
where it seems like bash completion scripts for some individual commands (like git, for example) are stored. I have yet to understand what this does and why it exists.cd
are defined. @GiselleSerate, you might run into the same problem with normal alias since they are both bash built-in commands (I think?)Okay, tab completion was a little enthusiastic. Alias doesn't do any tab completing. (I don't know where it would . . .) So we're going to call this a case of Tab Completion Isn't Duct Tape and close this issue.
This sounds really involved to do manually. Does normal alias do this? How does it do this?