Open paholg opened 5 months ago
I have found a simple solution to this.
In this section of the automatic completion generation from man-pages: https://github.com/nix-community/home-manager/blob/c0ef0dab55611c676ad7539bf4e41b3ec6fa87d2/modules/programs/fish.nix#L421-L430
We could add a line right after line 428, like this:
find $src -path "*/share/fish/vendor_completions.d/*.fish" | xargs -I {} cp {} $out
This would essentially overwrite the automatically generated completions by vendor provided ones. I have thought about the case where the user might want to opt for the generated completions for some reason, should this be guarded behind an option ?
Hope this helps ! If this resembles to a good solution, I might open a PR addressing this issue.
I think my previous solution was fundamentally flawed, I managed to add the path paholg mentioned to fish_completion_path
, I opened a PR for that.
Fish also includes Python3 by default, making the closure size to 220M (way too big for a shell). I believe we can do better, see this thread: https://github.com/NixOS/nixpkgs/pull/304313
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
Description
Right now, we generate fish completions from man-pages, which works well. However, some programs include their own completion definitions that are better than the generated ones, and these are not used by fish.
For example, in
zsh.nix
, we add various locations tofpath
: https://github.com/nix-community/home-manager/blob/36f873dfc8e2b6b89936ff3e2b74803d50447e0a/modules/programs/zsh.nix#L559-L561If I look in
/etc/profiles/per-user/paho/share/zsh/site-functions
, I see definitions for various packages I have installed, and zsh is able to use them for completions.However, we don't seem to do anything similar for fish.
I suspect this is an easy fix; I do have the directory
/nix/store/8js1fw8jwj9f1l2r7jlfbcx2k3vzi42k-home-manager-path/share/fish/vendor_completions.d
populated with the desired completions, and if I runthen they are used. However, I am not sure the correct way to specify this in
fish.nix
. I think part of my confusion is that we also havefunctions
andcompletions
symlinks there (which work in fish), but none of those end up in my config directory or config file.