Jonathan L.
Jonathan L.

Reputation: 21

How to remove trailing slash from ZSH’s _files results?

I’m trying to create an autocompletion rule for a function that take an existing directory which should be located in a specific directory as an argument.

VENVS_PATH="${ZDOTDIR:-$HOME}/.pyvenv"

compdef _venv_completion venv_activate
compdef '_files -W "${VENVS_PATH}" -/' venv_activate

This works, however when I’m typing venv_activate and hit TAB, Zsh suggest the right directories but with trailing slashes:

$ venv_activate
Dir1/  Dir2/

Is there a way to remove them without calling an external program?

Upvotes: 1

Views: 87

Answers (0)

Related Questions