Live data from Hacker News

Carapace: A multi-shell completion library and binary

carapace.sh

11–20 of 30 posts

Re: Carapace: A multi-shell completion library and binary

#11

Reminds of of Project Hail Mary. Never heard the word "carapace" before that book...

In Romanian "carapace" means shell. It seems to mean the same in English, too, but I presume is seldom used: https://en.wikipedia.org/wiki/Carapace

Re: Carapace: A multi-shell completion library and binary

#12
post #8

> Custom completions can be defined using yaml files. The concept is awesome but it's curious to see YAML at the core of this project, rather than a Turing-complete, embeddable language like Lua.

YAML is "good enough" for a vast range of tools. It's a good thing that these maintainers are focusing on their core competency/goal of the project and not pandering to niche HN opinions on the stuff that doesn't matter.

Re: Carapace: A multi-shell completion library and binary

#13
post #9

Earlier quoted context omitted.

I have had this snippet in my .zshrc for years, autoload -U compinit && compinit { # Compile the completion dump to increase startup speed. Run in background. zcompdump="${ZDOTDIR:-$HOME}/.zcompdump" if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then # if zcompdump file exists, and we don't have a compiled version or the # dump file is newer than the compiled file zcomp…

I just want to say - thank you! I've been using ZSH since it became the default on macOS and one thing that started annoying me recently is the slow startup time. Your snippet tangibly improved that. Do you by chance have any good resources on optimising my config further?

Beyond zprof (https://www.bigbinary.com/blog/zsh-profiling) not really I'm afraid. I did the majority of my zsh-prompt hacking 10 years ago and haven't thought about it since. That snippet could be from anywhere.

You could peek at something like zprezto https://github.com/sorin-ionescu/prezto or pure https://github.com/sindresorhus/pure for tips.

Fetching git/hg/... info is always slow, so try and speed that up where you can (as to how to do that, uhh... I know my prompt has a dirty-state check nicked from pure for speed reasons). You can also cache any `asdf init zsh` or similar to a file and do the same "run in background" trick so the next shell will have any changes.

The biggest improvement I can remember was dropping zprezto for my own much smaller config, I really did not need much comparatively. Mostly some git info and "good default" options. I use zgenom for a plugin manager but only have 3 plugins, probably I should just dump it and inline the plugins to avoid getting owned one day.

Re: Carapace: A multi-shell completion library and binary

#14

Reminds of of Project Hail Mary. Never heard the word "carapace" before that book...

In Romanian "carapace" means shell. It seems to mean the same in English, too, but I presume is seldom used: https://en.wikipedia.org/wiki/Carapace

It's not uncommon in English, though I suspect it's most often used in technical fields like entomology.

Re: Carapace: A multi-shell completion library and binary

#15

Earlier quoted context omitted.

> much faster than zsh script completions I'm curious where did you get that from. Edit: I read the note in your dotfiles repo. Yes calling `compinit` on each shell invocation is going to be really slow. That's not how you're supposed to do it, you could at least add the `-C` flag to cache the completions. Ideally you'd also use `zcompile` to compile the cache to ZSH word code. This puts my completions initializing t…

I have had this snippet in my .zshrc for years, autoload -U compinit && compinit { # Compile the completion dump to increase startup speed. Run in background. zcompdump="${ZDOTDIR:-$HOME}/.zcompdump" if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then # if zcompdump file exists, and we don't have a compiled version or the # dump file is newer than the compiled file zcomp…

> Do you have any pointers for the "load on tab" idea? I didn't turn up any good results in DDG and LLMs were just hallucinating.

This is bash, not zsh, but I have this working in my dotfiles by just telling bash where to look for my custom on-demand completions:

https://github.com/NateEag/dotfiles/blob/6862726ad2ecaa3a30e...

I imagine something similar works for zsh.

Re: Carapace: A multi-shell completion library and binary

#16

Reminds of of Project Hail Mary. Never heard the word "carapace" before that book...

In Romanian "carapace" means shell. It seems to mean the same in English, too, but I presume is seldom used: https://en.wikipedia.org/wiki/Carapace

Carapace is rarely used outside a zoological context, but people may be more familiar with the derived word "scarab", being a beetle with a notable shell. It is unfortunately unrelated to the delicious dish carpaccio, which is named after a man.

Re: Carapace: A multi-shell completion library and binary

#17

Reminds of of Project Hail Mary. Never heard the word "carapace" before that book...

In Romanian "carapace" means shell. It seems to mean the same in English, too, but I presume is seldom used: https://en.wikipedia.org/wiki/Carapace

It's pretty commonly used in my experience, but that might just be the types of books I read perhaps.

Re: Carapace: A multi-shell completion library and binary

#18
I tried to use this to get better completions with nushell, but it just doesn't have the breadth and depth of completions that fish has as of yet, nor does it have automatic completion generation from manages (although it does have a tool for that) so I eventually gave up and just made fish itself my nushell's completion engine. However I'll be keeping my eye on it, because it's a really cool idea to have a shared completion engine for all shells, so that everyone can pool their work, and because of course having to install two entire shells just to use one of them is a bit silly so eventually I'd like to make the switch.

Re: Carapace: A multi-shell completion library and binary

#20
post #14

Earlier quoted context omitted.

In Romanian "carapace" means shell. It seems to mean the same in English, too, but I presume is seldom used: https://en.wikipedia.org/wiki/Carapace

It's not uncommon in English, though I suspect it's most often used in technical fields like entomology.

I'm pretty sure you encounter in in science fiction as well, where some bug like alien has a carapace or a soldier has some armored exo-skeleton described by the word. Though I cannot think of any specific examples.
Post reply on HN