croc icon indicating copy to clipboard operation
croc copied to clipboard

Add _croc zsh completion file

Open vapniks opened this issue 2 years ago • 7 comments

vapniks avatar Jul 06 '22 18:07 vapniks

how does this need to be installed?

schollz avatar Jul 06 '22 19:07 schollz

It should be placed in one of the completion directories of $fpath, e.g. /usr/share/zsh/vendor-completions or ~/.oh-my-zsh/custom/completions

vapniks avatar Jul 06 '22 20:07 vapniks

Cool! Would you mind adding this to the install script? https://github.com/schollz/croc/blob/master/src/install/default.txt

schollz avatar Jul 06 '22 21:07 schollz

I would, but I notice that there's already some code which appears to be related to completion (lines 718-721 in default.txt). However I can't find the zsh_autocomplete_croc file that is referenced, and zsh_autocomplete doesn't make sense to me. Is that code incomplete? and if so shall I delete it and replace it with mine?

vapniks avatar Jul 06 '22 23:07 vapniks

Yeah I think the zsh autocomplete is not as robust as yours. The current file is here: https://github.com/schollz/croc/blob/master/src/install/zsh_autocomplete

Feel free to replace it with your solution!

schollz avatar Jul 06 '22 23:07 schollz

When I get the time

vapniks avatar Jul 08 '22 09:07 vapniks

I know how to find the completions directory automatically using zsh ("${(M@)fpath:#*completions*}"), but the install script is written in bash which means I'd have to do a series of tests for existence of certain assumed directories, which might not include the one that the user actually uses for completions. I think it might be better to just ask the user to copy the _croc file manually. What do you think?

vapniks avatar Jul 11 '22 17:07 vapniks