BrainArchitect
BrainArchitect

Reputation: 561

Modify cd tab autocompletion to show like ls -la

In a file structure like:

|-/
|-foo
|--bar1
|--bar2
|--bar3.txt

Being at the / level and typing cd f followed by Tab+Tab I see this:

~ / cd foo
/bar1 /bar2

Since I use oh-my-zsh, I can then navigate between all options with and select a directory. Is there a way to modify my bash profile, to make it produce a "list-like" output similar to the one I get from ls -l, so I have all options listed vertically instead of horizontally?

Expected (after cd f + Tab+Tab):

~ / cd foo/
drwxr-xr-x 22 admin home 748 Feb 3 15:19 bar1
drwxr-xr-x 16 admin home 544 Feb 3 15:19 bar2

Thanks in advance.

Upvotes: 0

Views: 559

Answers (1)

Adaephon
Adaephon

Reputation: 18329

You can enable this behavior by using the file-list completion style. Just add the following line to your ~/.zshrc:

zstyle ':completion:*' file-list all

With Oh-My-Zsh it might be necessary to add the line after sourcing oh-my-zsh.sh. Alternatively you can put a file with extension .zsh and the above line as content into ~/.oh-my-zsh/custom.

Upvotes: 2

Related Questions