From 2c206abb0ea835b839c8c60af9cba4f1034fd80f Mon Sep 17 00:00:00 2001 From: Nick Kocharhook Date: Wed, 27 Jul 2022 09:33:41 +0100 Subject: [PATCH] Document how to configure zsh completions on MacOS (#1285) --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index fedc429..2d1f6cb 100644 --- a/README.md +++ b/README.md @@ -2139,6 +2139,23 @@ The `just` binary can also generate the same completion scripts at runtime, usin $ just --completions zsh > just.zsh ``` +*macOS Note:* Recent versions of macOS use zsh as the default shell. If you use Homebrew to install `just`, it will automatically install the most recent copy of the zsh completion script in the Homebrew zsh directory, which the built-in version of zsh doesn't know about by default. It's best to use this copy of the script if possible, since it will be updated whenever you update `just` via Homebrew. Also, many other Homebrew packages use the same location for completion scripts, and the built-in zsh doesn't know about those either. To take advantage of `just` completion in zsh in this scenario, you can set `fpath` to the Homebrew location before calling `compinit`. Note also that Oh My Zsh runs `compinit` by default. So your `.zshrc` file could look like this: + +```zsh +# Init Homebrew, which adds environment variables +eval "$(/opt/homebrew/bin/brew shellenv)" + +fpath=($HOMEBREW_PREFIX/share/zsh/site-functions $fpath) + +# Then choose one of these options: +# 1. If you're using Oh My Zsh, you can initialize it here +# source $ZSH/oh-my-zsh.sh + +# 2. Otherwise, run compinit yourself +# autoload -U compinit +# compinit +``` + ### Grammar A non-normative grammar of `justfile`s can be found in [GRAMMAR.md](https://github.com/casey/just/blob/master/GRAMMAR.md).