Is there a way to remove the trailing forward slashes in the tab-completion output of Zsh when I start writing a cd command and tab to see a list of directories?


~ cd <tab>
Adlm/                       Desktop/
Applications/               Development/

I was wondering if there's any way to remove the slashes after the directory names, to show Adlm instead of Adlm/, etc.

  • 3
    Pressing TAB to yield a menu of completions is autocompletion. But the purported duplicate is clearly about making a different shell mimic a different aspect of the Z shell (i.e. what happens in the resultant command line when a directory completion is selected rather than how directories are displayed in the menu by menu completion). – JdeBP Oct 24 '18 at 6:13
  • @JigglyNaga I came across that solution before I posted this question. I've even tried them as I have misunderstood the question at first. It does not work. – user1164937 Oct 24 '18 at 12:24
  • 2
    Ah, I've just noticed that you included the zsh and oh-my-zsg tags. – JigglyNaga Oct 24 '18 at 13:36

In zsh, it's:

set +o list_types

When using complist, you can also change its color to make it less visible:

zstyle ':completion:*' list-colors tc=33 ${(s.:.)LS_COLORS}

to make it yellow (less visible on a terminal with white background), and use the GNU ls colors (assuming you've run eval "$(dircolors)") for the rest.

  • Thanks for putting so much effort into this simple question :) – user1164937 Oct 24 '18 at 14:36
  • @user1164937, see latest edit though which you may have missed as you accepted the answer shortly after I made it. – Stéphane Chazelas Oct 24 '18 at 14:45
  • I already had that line of code to match the colors of my theme just a few hours ago. Thanks again! – user1164937 Oct 24 '18 at 14:48

I tested that solution, specifically the bind command:

bind 'set mark-directories off'
  • 3
    $ zsh, % bind 'set mark-directories off', zsh: command not found: bind. Should that work with plain zsh, or is there something else that is required? – ilkkachu Oct 24 '18 at 13:44

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.