Open xenoterracide opened 3 years ago
Having the same issue with fish shell on MacOS.
> yadm --version && fish --version && uname -a
yadm 3.1.0
fish, version 3.3.1
Darwin my-mbpro.local 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64
Same problem on yadm 3.1.0, fish 3.3.1, Linux
Same problem yadm 3.1.0
, fish 3.3.1
.
Is there really no fix or workaround in sight for this?
I read through two closed issues in the fish repo to try and find a hint for a solution.
One of the main fish developers (@faho) seems to basically say that tab completion to be very slow is to be expected when using $HOME
as a git repo, because $HOME
is usually very large (as in a huge number files).
I tried multiple variations of a ~/.gitignore
to ignore most of $HOME
as a workaround. One of the variations seemed to speed things up a little bit, but it was still way too slow to be pleasantly usable. I wonder if all yadm users who also use fish or zsh have this problem or just some?
Also I just tried, and the path completion works just fine with bash.
yeah, I still have the same issue.
I did manage to speed it up significantly by putting almost everything in ~/.gitignore though:
~ 1.7s » cat .gitignore
/notes
/tmp
/downloads
/sync
/repos
/projects
/pictures
/videos
/.local/share/fish
/.local/share/kak
/.config/chromium
.terminfo
.npm
.mozilla
.cargo
.local/cargo
.local/go
.local/lib
.local/share/Trash
.local/share/trash
.cache/
how about this work around? For me when I want to yadm add
something its because I added a new config file that's untracked. for everything else that is tracked I use yadm add -u
.
unless there is a more supported way to manage our dotfiles that keeps the git add
completion intact I would think it would be better to make this the functionality by default because the freeze on yadm add
is confusing for new users.
# ~/.zshrc
function _yadm-add(){ _ls }
Edit: with a bit more trickery we could have the best of both worlds.
function _yadm-add(){
yadm_path="$(yadm rev-parse --show-toplevel)"
yadm_options=$(yadm status --porcelain=v1 |
awk -v yadm_path=${yadm_path} '{printf "%s/\"%s\"\\:\"%s\" ", yadm_path, $2, $1 }' )
_alternative \
"args:custom arg:(($yadm_options))" \
'files:filename:_files'
}
(anything better to do the formatting than awk?)
Same problem with MacOs 12.1
, yadm 3.1.1
& zsh 5.8
Same on Fedora 35
, yadm 3.1.1
, fish 3.3.1
However on fish there is a workaround to only use Ctrl+F to complete, which is a built-in functionality of the fish shell.
To move this along I made a pull request https://github.com/TheLocehiliosan/yadm/pull/417 From there we can look into improving the completion script to something ideal for everyone.
I can confirm that Fish tab completion is still broken in 3.2.2.
@TheLocehiliosan I somehow missed your comment, just happened to see it now.
❯ yadm --version && fish --version && uname -a
bash version 5.2.2(1)-release
git version 2.37.2
yadm version 3.2.2
fish, version 3.5.1
Linux igor 5.19.0-45-generic #46-Ubuntu SMP PREEMPT_DYNAMIC Wed Jun 7 09:08:58 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Is there any other information I can provide that would be helpful?
Bump on this — love yadm (3.1.1) but tab completion hangs with fish (3.3.1) is a big deal when adding previously untracked files. Anybody found a fix for this in fish?
This appears to be an issue with the git completions bundles inside fish and not an issue with yadm.
You can see this behaviour by creating a new repo in your home with git init
then entering git add
and pressing tab. It will hang, likely due to the number of files which are untracked from your home directory.
I fixed this in zsh for yadm by just overwriting the default completions and putting in completion based on yadm status and ls
I'm sure we can just copy a fish equivalent function over
The autocomplete for the git commands in fish come from telling complete
that it's wrapping all of git
, which passes through all of the git autocompletes which are bundled inside fish itself.
I tried adding my own autocomplete for add
but it still seemed to use the git one for some reason. It's the first time I've tried to create autocompletions though.
This is what I have so far
function __fish_yadm_status_options
# set -l fish_trace on
set -l yadm_path (yadm rev-parse --show-toplevel)
set -l yadm_status (yadm status --porcelain=v1 | awk '{print $2}')
set -l yadm_options (echo "$yadm_status" | awk -v yadm_path="$yadm_path" '{printf "%s/%s%s\n", yadm_path, $2, $1}' )
echo $yadm_options
end
complete -e yadm --wraps 'git --git-dir=/home/joshua/.local/share/yadm/repo.git'
complete -c yadm -n "__fish_seen_subcommand_from add" -a "(__fish_yadm_status_options)"
complete -c yadm -n "__fish_seen_subcommand_from add" -F
complete -c yadm -n "__fish_seen_subcommand_from checkout" -a "(__fish_yadm_status_options)"
complete -c yadm -n "__fish_seen_subcommand_from checkout" -F
The part I haven't fixed yet is that when applied complete -e yadm --wraps 'git --git-dir=/home/joshua/.local/share/yadm/repo.git'
will delete all the completions, but what I want is just to overwrite specific completions for git add
and git checkout
I think the solution would be to wrap git completions for specific command and not everything.
Put into .config/fish/completions/yadm.fish
to test, but will remove the default completions.
I don't think fish
has to ability to wrap specific completions from git
but ignore a couple.
To fully fix this I think you would have to loop through the git completion file and ignore specific lines, which is ugly.
Thanks for looking into this @joshzcold. It looks like we got to the same point in deciding that it wasn't possible to wrap a command but overwrite just some of the completions.
I have posted on the Fish Shell mailing list to ask if there is the ability to do this currently. Hopefully someone who knows more about Fish completions can provide some help from there.
A slight workaround I do for yadm add ...
on fish is to type the first couple characters of the file I want, then use ctrl + e
or right arrow key
to complete the filename. Not quite as powerful as true tab completion, but it's something.
You can also do yadm add (ls <tab>)
for hacky tab completion.
This bug is ridiculously annoying. It freezes my terminal for 20sec :(
when typing
yadm add <tab>
files are never listed, and my shell seems to hang. This may be related to #292 but I don't know.