From 4117b0ddb6c3ca54524bd1c312c1505376d4a128 Mon Sep 17 00:00:00 2001 From: rootiest Date: Sat, 6 Jun 2026 04:37:54 -0400 Subject: [PATCH] feat(tricks): auto-create fish-config.1 symlink on shell start The symlink from ~/.local/share/man/man1/fish-config.1 to docs/fish-config.1 is now created automatically alongside the existing MANPATH setup, making `man fish-config` work out of the box on any machine after cloning. Simplified docs accordingly. --- README.md | 4 ++-- conf.d/tricks.fish | 8 +++++++- docs/fish-config.md | 12 ++++++------ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5f6b6de..837bde5 100644 --- a/README.md +++ b/README.md @@ -321,13 +321,13 @@ The viewer falls back through: **ov** (syntax highlight + section navigation) Examples: `config_help keybindings` · `config_help pkg` · `config_help fish-deps` · `config_help abbreviations` -You can also read the documentation as a standard man page: +You can also read the documentation as a standard man page — the symlink and `MANPATH` are set up automatically on shell start: ```fish man fish-config ``` -This works once `~/.local/share/man` is on your `MANPATH` (added automatically by `conf.d/tricks.fish`) and `~/.local/share/man/man1/fish-config.1` is symlinked to `docs/fish-config.1`. The man page itself is auto-generated from `docs/fish-config.md` by the CI pipeline on every push to `main`. +The man page is auto-generated from `docs/fish-config.md` by the CI pipeline on every push to `main`. > **Note:** `fish-config` (hyphen) is this configuration's man page. `fish_config` (underscore) is fish's built-in browser-based configuration tool — a completely separate command. Don't mix them up. diff --git a/conf.d/tricks.fish b/conf.d/tricks.fish index b989a48..1e48268 100644 --- a/conf.d/tricks.fish +++ b/conf.d/tricks.fish @@ -17,10 +17,16 @@ end fish_add_path ~/.local/bin fish_add_path ~/Applications/depot_tools -# Expose user-local man pages (e.g. fish-config.1 symlinked from docs/) +# Expose user-local man pages and keep fish-config.1 symlink current if not contains ~/.local/share/man $MANPATH set -gx MANPATH ~/.local/share/man $MANPATH end +set -l _man1 ~/.local/share/man/man1 +set -l _src ~/.config/fish/docs/fish-config.1 +if test -f $_src; and not test -L $_man1/fish-config.1 + mkdir -p $_man1 + ln -sf $_src $_man1/fish-config.1 +end # Format man pages using bat (only if bat is installed) if type -q bat diff --git a/docs/fish-config.md b/docs/fish-config.md index f3f7b58..3d1244f 100644 --- a/docs/fish-config.md +++ b/docs/fish-config.md @@ -1231,16 +1231,16 @@ navigation. bat --language=markdown --paging=always ~/.config/fish/docs/fish-config.md -## As a man page (if compiled) +## As a man page - man -l ~/.config/fish/docs/fish-config.1 - -If ~/.local/share/man is on your MANPATH (set automatically by -conf.d/tricks.fish) and ~/.local/share/man/man1/fish-config.1 is -symlinked to docs/fish-config.1, you can also use: +The symlink and MANPATH are configured automatically on shell start: man fish-config +Or read the compiled file directly: + + man -l ~/.config/fish/docs/fish-config.1 + NOTE: fish-config (hyphen) is this config's man page. fish_config (underscore) is fish's built-in browser-based configuration tool — a completely separate command. Do not mix them up.