24

Currently when I invoke completion the behaviour is like this:

% cd ~/<TAB>
Completing directory
Desktop/    Downloads/  Pictures/   system/     Videos/
Documents/  Music/      Public/     Templates/  www/

How can I configure the completion to list the hidden files also?

2 Answers 2

27

This is a zsh option. It is mentioned in its introduction.

GLOBDOTS lets files beginning with a . be matched without explicitly specifying the dot.

Add the following to your .zshrc file.

setopt globdots
2
15

You could add globdots to $_comp_options in your .zshrc e.g.

.....
compinit
_comp_options+=(globdots)
.....
6
  • 4
    Is there an easy way to ignore the current directory (.) and parent directory (..)? They are often useless on a comp list. Dec 10, 2018 at 9:59
  • 3
    @KrzysztofKaczor - Those are never shown in the completion list unless your .zshrc contains something like this: zstyle ':completion:*' special-dirs true in which case they are listed so it's an easy fix ;) Dec 10, 2018 at 18:05
  • 3
    thanks! turns out it's part of oh-my-zsh config. Dec 10, 2018 at 19:26
  • 1
    One of the maintainers of Oh My Zsh said that only _comp_options+=(globdots) is necessary. Do I really need compinit, too?
    – Lucas
    Sep 26, 2020 at 16:29
  • 1
    I don't know why but my config had _comp_options+=(globdots) and it was not working. After changing it to setopt globdots it works.
    – Luciano
    Apr 17, 2022 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.