Search code examples
functionautocompletezshaliases

Autocompletion based on filenames in a directory


I want to have a function in my zsh for faster accessing my todo-files. It should look inside the folder ~/tasks where i put my todo-lists and stuff. Now i want to type task p and when I hit tab, it should use the files in that directory for autocompletition. Can anyone point me some direction? Or share some snippet to work with?

Thanks


Solution

  • This would seem to do the trick:

    compdef '_files -W "$HOME/tasks"' task