fish-shell / fish-shell/fish-shell
pushd completions include file names from the current directory
- Dominant language
- Rust
- Stars
- 34.2k
- Forks
- 2.4k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 13
Description
fish version: 4.3.2
OS: Fedora 43
I've tried this without third-party customizations.
## Expected behavior
Since pushd is used to navigate the directory stack and change directories (similar to cd), completion should only suggest directory names and the directory stack (e.g., +1, -0). Regular files should be filtered out of the completion suggestions to reduce noise.
## Actual behavior
When typing `pushd `, fish suggests all files and directories in the current working directory. Regular files are included even though they are not valid arguments for the command.
## Steps to reproduce
1. Create a dummy file: `touch should_not_appear.txt`
1. Type `pushd ` and press ``.
1. The file `should_not_appear.txt` is listed as a suggestion.
## Workaround
I've created `~/.config/fish/completions/pushd.fish` with the following content as a workaround.
```fish
complete -c pushd -e
source /usr/share/fish/completions/pushd.fish
# Don't suggest files in $PWD, only directories
complete -c pushd -f
complete -c pushd -a '(__fish_complete_directories (commandline -ct))'
```
Contributor guide
Assessment
This issue has not been assessed yet.