The result is that Tab is only able to complete options, and not the paths to the files that one may want to display.
Thank you for reporting this.
I think this is related to https://github.com/clap-rs/clap/issues/568
I guess we have the same problem with other shell completion files.
Personally I scarcely use bat options, or at least I use options way less frequently than filenames, so I much prefer to complete filenames instead of options.
Could you disable these completions until the upstream error is fixed?
@swiesner-dlr I agree. Sounds like a good idea to me. We should enable the shell completions for the next release.
Shell completions are not included in the new release bat 0.9.
I'm still having this issue鈥擨 get tab-completion for options, but not for filenames. I'm using bat 0.9.0 (newly installed via homebrew) and I'm using fish 3.0.0 (recently upgraded from 2.7.1 in case an outdated fish version was the problem). I haven't tried building from source; is that worth an attempt?
Can you please search your filesystem for any remaining fd.fish autocompletion files?
It seems like the brew formula still ships the completion files: https://github.com/Homebrew/homebrew-core/blob/5df9397fb96b3e74b7aca993afa2b620e0db9d44/Formula/bat.rb
I'm afraid this would have to be reported in the homebrew-core repository.
Thanks! I removed /usr/local/Cellar/bat/0.9.0_1/share/fish/vendor_completions.d/bat.fish and now it's working as expected :)
Edit: I put it back and removed the /usr/local/share/fish/vendor_completions.d/bash.fish symlink instead
Shell completions are not included in the new release bat 0.9
I believe this is incorrect. The completion files are still built during cargo install, they are produced by build.rs. If they weren't built, Homebrew wouldn't be able to install them :)
Yes - sorry. I just removed them from the tarballs and the Debian packages. If that is needed, we can disable building these files all together. If you think that is required, please open a new ticket.
How long would it take for homebrew to pick up the new changes? Ie, at 1807 25/01/2019 I ran a brew install bat and am seeing the bat.fish completion files.
I have now completely disabled the generation of the files, so for the next release package maintainers will be "forced" to remove them from the packages.
If, somehow, you still have the old completions, you can also just add
complete -c bat -a '(__fish_complete_path)'
to your config and have it all. ;)
Maybe, there is a simple way to add this to the generated completions, so you can re-enable them, @sharkdp?
@alexbepple Oooh, thanks for this, very handy!
@sharkdp I'm sure you've thought of this already, but another workaround would be to stop using a subcommand and instead:
cache into normal arguments that use dashes, like bat --init-cache, bat --clear-cache, ...bat-cache --init, ...Personally I wouldn't expect a tool like bat to take a subcommand at all, since it always gets a file argument anyways, and that could collide with the subcommand and cause confusion.
@sharkdp I'm sure you've thought of this already, but another workaround would be to stop using a subcommand and instead:
The cache subcommand is not the problem here. The argument parser clap, which we use, does not support the generation of proper shell completion files even if there would be no subcommand (see my first comment in this issue).
No shell completion files should be shipped with v0.10.0.
For anyone watching this 0.10.0 is now out on homebrew and completion now works great! 馃帀
Most helpful comment
Personally I scarcely use
batoptions, or at least I use options way less frequently than filenames, so I much prefer to complete filenames instead of options.Could you disable these completions until the upstream error is fixed?