After reading this article, I set CDPATH=.:~
. However, I do not have tab completion through the directories in my home directory. I was wondering if anyone was aware of ways to do this.
-
1I don't think that setting CDPATH gives you tab completion. It allows you to cd to a sub-directory of any of the directories listed by just entered the sub-directory name.– dmahNov 30, 2010 at 17:55
-
On my Ubuntu desktop system, I can type "cd D" (in a directory other than ~) and press Tab twice and see "Desktop/ Documents/ Downloads/" as proposed destinations. Do you not get similar behavior?– Dennis WilliamsonNov 30, 2010 at 18:24
1 Answer
You should install and enable bash-completion — it defines a _cd
function and sets it as the completer for the cd
command, which overrides the default completion and includes $CDPATH
.
-
It works on mac too. The answer link is broken but it was easy to locate the package in
brew
.– NiloctOct 29, 2022 at 17:04