I would like to create a fish function that acts as a shortcut into a directory.
The function looks like this:
function mydir -d "Navigate to mydir and its subdirectories from anywhere"
cd $HOME/some/path/mydir/$argv
end
The function works well, but I would like to add tab-completion. I currently have this for tab-completion:
complete --no-files --exclusive --command mydir --arguments "(__fish_complete_directories)"
The problem is that this will tab-complete to the directories in the current working directory. I would instead like it to tab-complete to the directories in $HOME/some/path/mydir/. I cannot find an example or flag in the documentation that would help me do this.
I do not know fish very well, but I thought one way to do this would be to manually loop over those directories and add them as options, but it doesn't feel right and I am struggling with that implementation anyway.