From caf9a75c007446da1c347e3089a20f4ad72c9b9a Mon Sep 17 00:00:00 2001 From: Jon Ludlam's Agent Date: Tue, 23 Jun 2026 09:19:32 +0100 Subject: [PATCH] docs: use `opam var odoc-switchdocs:share` for the completion fpath Cleaner and layout-robust than hardcoding $OPAM_SWITCH_PREFIX/share/... Co-Authored-By: Claude Opus 4.8 (1M context) --- README.md | 7 +++---- completions/zsh/_switchdocs | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2dc3eec..5efd89c 100644 --- a/README.md +++ b/README.md @@ -59,12 +59,11 @@ subcommands and, for `show` and `complete`, the reference argument — by callin (`Stdlib` open, package-qualified `/pkg/...` paths, kind tags like `type-`, section labels, …). Type `.` or `/` and press TAB again to drill in. -`opam install` puts it under `$OPAM_SWITCH_PREFIX/share/odoc-switchdocs/zsh`. -That directory isn't on zsh's `$fpath` by default, so add it (before -`compinit`) in `~/.zshrc`: +`opam install` puts it under the package's share dir. That directory isn't on +zsh's `$fpath` by default, so add it (before `compinit`) in `~/.zshrc`: ```zsh -fpath=("$OPAM_SWITCH_PREFIX/share/odoc-switchdocs/zsh" $fpath) +fpath=("$(opam var odoc-switchdocs:share)/zsh" $fpath) autoload -U compinit && compinit ``` diff --git a/completions/zsh/_switchdocs b/completions/zsh/_switchdocs index cdb096e..131a37f 100644 --- a/completions/zsh/_switchdocs +++ b/completions/zsh/_switchdocs @@ -3,9 +3,9 @@ # zsh completion for switchdocs. # # Install: put this file's directory on $fpath before compinit. After -# `opam install` it lives under the switch's share dir; add to ~/.zshrc: +# `opam install` it lives under the package's share dir; add to ~/.zshrc: # -# fpath=("$OPAM_SWITCH_PREFIX/share/odoc-switchdocs/zsh" $fpath) +# fpath=("$(opam var odoc-switchdocs:share)/zsh" $fpath) # autoload -U compinit && compinit # # (or point $fpath at completions/zsh in a source checkout.) -- 2.51.2