Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,24 @@

| Layer | Owns | Mechanism |
|----------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|
| **[omnishell](https://github.com/JtheGunner/omnishell)** | rc *lines*: plugin inits, history, completion, `zsh-completions`, `dynamic-completion`, `fzf`, `navi`, `zoxide`, `modern-aliases`, `colorized-man`, `tealdeer`, `you-should-use`, `direnv`, `broot`, `mise`, `starship` (prompt + its seeded config), `root-loops` (OSC palette push), `tmux` (installs it; auto-attach is off) | one marker block in `~/.zshrc` / `~/.bashrc`, sourcing a generated `init.<shell>` |
| **[omnishell](https://github.com/JtheGunner/omnishell)** | rc *lines*: plugin inits, history, completion, `zsh-completions`, `dynamic-completion`, `zsh-edit-select`, `fzf`, `navi`, `zoxide`, `modern-aliases`, `colorized-man`, `tealdeer`, `you-should-use`, `direnv`, `broot`, `mise`, `starship` (prompt + its seeded config), `root-loops` (OSC palette push), `tmux` (installs it; auto-attach is off) | one marker block in `~/.zshrc` / `~/.bashrc`, sourcing a generated `init.<shell>` |
| **this repo: stow packages** | standalone config *files*: `git`, `tmux` (`.tmux.conf` only), `bat`, `ghostty` (+ optional `nvim`) | [GNU Stow](https://www.gnu.org/software/stow/) symlinks into `$HOME` |
| **this repo: rc libraries** | the base `~/.zshrc` / `~/.bashrc` content: env, keybindings, zsh completion styling | `zsh/zshrc.zsh` + `bash/bashrc.bash`, **`source`d** from a generated real rc file (not stowed, see below) |
| **this repo: `shell.d/`** | personal rc lines not worth a public module: k8s / docker aliases, `linuxbrew`, helper functions | a second marker block, sourced *after* omnishell |
| **`~/.zshrc.local` / `~/.bashrc.local`** | machine-specific and secret: per-host `PATH`, tool completions, tokens. **Not version-controlled.** | sourced last by the same marker block |

omnishell is consumed as a released binary (Homebrew tap / curl installer); this
repo never modifies it. **omnishell 0.10.0 or newer is required**: older releases
repo never modifies it. **omnishell 0.11.0 or newer is required**: older releases
don't know all of the `starship`, `root-loops`, `tmux`, `broot`, `direnv`, `mise` and
`colorized-man` modules, and install `mise`, `starship` and `broot` with a long
source build where no distro package exists, 0.7.0 is the first with
`omnishell tui`, which `--interactive` uses, before 0.7.1 a tool installed
from a release binary or a source build is not on `PATH` at shell start (no
`starship` prompt), before 0.8.0 `modern-aliases` is degraded where the
distro has no `eza` package, before 0.9.0 there is no `zsh-completions`
module, and before 0.10.0 there are no `navi`, `tealdeer`, `you-should-use` and
`dynamic-completion` modules. `bootstrap.sh` upgrades an older
module, before 0.10.0 there are no `navi`, `tealdeer`, `you-should-use` and
`dynamic-completion` modules, and before 0.11.0 there is no `zsh-edit-select`
module. `bootstrap.sh` upgrades an older
install, or stops with a message if it can't.

```text
Expand Down Expand Up @@ -80,11 +81,11 @@
`bootstrap.sh`:

1. checks that nothing points at another checkout (see [Multiple checkouts](#multiple-checkouts))
2. installs dependencies, omnishell (upgrading it below 0.10.0) and Ghostty (unless switched off), and zsh if you opted in, then offers to make zsh your login shell (see [Settings file](#-settings-file)); on apt systems with a CPU other than x86_64 / arm64 also a Rust toolchain
2. installs dependencies, omnishell (upgrading it below 0.11.0) and Ghostty (unless switched off), and zsh if you opted in, then offers to make zsh your login shell (see [Settings file](#-settings-file)); on apt systems with a CPU other than x86_64 / arm64 also a Rust toolchain
3. writes real `~/.zshrc` / `~/.bashrc`
4. stows the packages (unless skipped)
5. writes the git `delta` config and asks for your git identity (unless skipped) (see [Git identity](#-git-identity))
6. on Homebrew, removes the group/other write bit from `share` and `share/zsh` so zsh's `compinit` accepts the `zsh-completions` directory (unless switched off), then applies `omnishell/config.toml`, which also installs `zsh-completions`, `navi`, `tealdeer`, `you-should-use`, `starship`, `mise`, `tmux`, `direnv` and `broot`
6. on Homebrew, removes the group/other write bit from `share` and `share/zsh` so zsh's `compinit` accepts the `zsh-completions` directory (unless switched off), then applies `omnishell/config.toml`, which also installs `zsh-completions`, `navi`, `tealdeer`, `you-should-use`, `zsh-edit-select`, `starship`, `mise`, `tmux`, `direnv` and `broot`
7. appends the `shell.d` block to both rc files
8. renders the terminal colour themes

Expand Down Expand Up @@ -123,7 +124,7 @@
>
> Fix the cause (or install the packages yourself) and re-run `./bootstrap.sh`.

### Multiple checkouts

Check warning on line 127 in README.md

View workflow job for this annotation

GitHub Actions / docs-drift

doc-drift

Section "Multiple checkouts" may be outdated: linked code changed but the section did not (changed code: bootstrap.sh).

Several clones on one machine are fine, e.g. a working copy to hack on and a
second one to test the install end to end. Only one of them is live. Two things
Expand Down Expand Up @@ -166,7 +167,7 @@

---

## ⚙️ Settings file

Check warning on line 170 in README.md

View workflow job for this annotation

GitHub Actions / docs-drift

doc-drift

Section "⚙️ Settings file" may be outdated: linked code changed but the section did not (changed code: bootstrap.sh, omnishell/config.toml).

Every per-machine choice lives in one untracked file:
`~/.config/dotfiles/config.toml`. The first run copies
Expand Down Expand Up @@ -273,7 +274,7 @@

---

## 🪪 Git identity

Check warning on line 277 in README.md

View workflow job for this annotation

GitHub Actions / docs-drift

doc-drift

Section "🪪 Git identity" may be outdated: linked code changed but the section did not (changed code: bootstrap.sh).

This repo ships **no** `user.name` / `user.email`. The git config sets
`user.useConfigOnly = true` instead, so git refuses to commit until you set an
Expand All @@ -289,7 +290,7 @@
git config --file ~/.gitconfig.local user.email "12345+you@users.noreply.github.com"
```

### ✍️ Signing commits with SSH (optional)

Check warning on line 293 in README.md

View workflow job for this annotation

GitHub Actions / docs-drift

doc-drift

Section "✍️ Signing commits with SSH (optional)" may be outdated: linked code changed but the section did not (changed code: bootstrap.sh).

`bootstrap.sh` also asks for the path to your **public** SSH key. Give just the
path and the rest of the signing setup is derived from it. Leave it empty to
Expand Down Expand Up @@ -317,7 +318,7 @@

---

## ⚙️ Configuring

Check warning on line 321 in README.md

View workflow job for this annotation

GitHub Actions / docs-drift

doc-drift

Section "⚙️ Configuring" may be outdated: linked code changed but the section did not (changed code: bootstrap.sh, omnishell/config.toml).

Every setting lives in **one** of five places. None of this needs `bootstrap.sh`
re-run (though re-running it is always safe); the "Apply with" column says how
Expand Down Expand Up @@ -388,6 +389,7 @@
| `navi` | interactive cheatsheet browser on Ctrl+G (uses `fzf`) | `key = "ctrl-g"` |
| `tealdeer` | `tldr`: short command examples instead of long man pages | - |
| `you-should-use` | zsh only: reminds you of an existing alias for the command you typed | `message_position`, `mode`, `ignored_aliases` |
| `zsh-edit-select` | zsh only: edit the command line like a text editor (Shift selection, copy, cut, paste, undo, mouse); see below | `terminal_ghostty = true` |
| `zoxide` | smarter `cd` | `cmd = "z"` |
| `modern-aliases` | `ls` / `cat` / `find` → `eza` / `bat` / `fd` | `replace = [...]` |
| `colorized-man` | man pages through `bat`; plain `less` colours when `bat` is missing | - |
Expand All @@ -398,6 +400,13 @@
| `root-loops` | OSC 4/10/11 palette push on shell start | `appearance = "dark"` |
| `tmux` | installs tmux; optional auto-attach to a session on shell start | `session = "default"`, `auto_attach = false` |

`zsh-edit-select` needs key bindings in the terminal. `omnishell apply` writes the Ghostty ones
to `~/.config/ghostty.local` (`terminal_ghostty = true`); restart Ghostty afterwards. That file loads
after the tracked keybinds, so `Cmd+A` / `Cmd+C` / `Cmd+X` / `Cmd+Z` act on the command line instead of
selecting or copying terminal text (`copy-on-select` still copies mouse selections). On macOS the mouse
selection needs the Accessibility permission: run `edit-select setup-ax`. The Linux Ghostty
bindings overlap with `keybinds-linux.conf` and are not verified.

`ble-sh` (bash autosuggestions and highlighting) is not enabled: omnishell rejects it together with `fzf`, which `navi` needs.

`starship`, `mise`, `tmux`, `direnv` and `broot` are **installed** by
Expand Down Expand Up @@ -427,7 +436,7 @@
shells start outside it. Flip it to `true` to attach to (or create) the
`default` session on every shell start.

### 4. Stow packages: standalone config files

Check warning on line 439 in README.md

View workflow job for this annotation

GitHub Actions / docs-drift

doc-drift

Section "4. Stow packages: standalone config files" may be outdated: linked code changed but the section did not (changed code: bootstrap.sh).

`stow` symlinks these into `$HOME`, so **editing the file in the repo changes the
live config immediately** (you may still need to reload the target app). After
Expand Down Expand Up @@ -469,7 +478,7 @@

---

## 🎨 Colours: Root Loops

Check warning on line 481 in README.md

View workflow job for this annotation

GitHub Actions / docs-drift

doc-drift

Section "🎨 Colours: Root Loops" may be outdated: linked code changed but the section did not (changed code: bootstrap.sh, omnishell/config.toml).

Terminal colours are defined **once**; everything else inherits the 16 ANSI
colours. See [`rootloops`](rootloops):
Expand Down Expand Up @@ -537,7 +546,7 @@
tests/ test-*.sh (make test) + bootstrap-smoke.sh (CI)
```

### Notes

Check warning on line 549 in README.md

View workflow job for this annotation

GitHub Actions / docs-drift

doc-drift

Section "Notes" may be outdated: linked code changed but the section did not (changed code: bootstrap.sh).

- The git config lives at `~/.config/git/config` (not `~/.gitconfig`). The
`delta` paging config is `~/.gitconfig.delta`, which `bootstrap.sh` writes only
Expand Down
5 changes: 3 additions & 2 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,13 @@ reload_settings() {
# eza as a release binary where the distro has no package (Debian 12), instead
# of degrading modern-aliases; 0.9.0 adds the zsh-completions module (fpath before
# compinit) and the `omnishell doctor` check for writable completion directories;
# 0.10.0 adds the navi, tealdeer, you-should-use and dynamic-completion modules.
# 0.10.0 adds the navi, tealdeer, you-should-use and dynamic-completion modules;
# 0.11.0 adds the zsh-edit-select module.
# What has no
# binary (broot on 32-bit ARM, mise on armv6, everything on other CPUs) still
# builds from source, which needs Rust 1.95 for mise / starship (broot: 1.85) -
# newer than what Debian / Ubuntu LTS ship as `cargo`.
OMNISHELL_MIN_VERSION="0.10.0"
OMNISHELL_MIN_VERSION="0.11.0"
RUST_MIN_VERSION="1.95"

# What a cargo build of mise needs besides Rust: a C toolchain, cmake (libz-ng-sys),
Expand Down
12 changes: 12 additions & 0 deletions omnishell/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ enabled = true
[modules.syntax-highlighting]
enabled = true

# Edit the command line like a text editor: Shift+arrow selection, copy, cut, paste,
# undo and mouse selection (zsh only; omnishell >= 0.11.0). It loads after
# autosuggestions and syntax-highlighting. The terminal has to send the plugin's key
# sequences to the shell: terminal_ghostty makes `omnishell apply` write the Ghostty
# keybinds to ~/.config/ghostty.local (loaded after the tracked keybinds, so Cmd+A /
# Cmd+C / Cmd+X / Cmd+Z act on the command line; restart Ghostty afterwards). On macOS
# mouse selection also needs the Accessibility permission: run `edit-select setup-ax`.
[modules.zsh-edit-select]
enabled = true
[modules.zsh-edit-select.options]
terminal_ghostty = true

[modules.fzf]
enabled = true
[modules.fzf.options]
Expand Down
4 changes: 2 additions & 2 deletions tests/test-interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ check "the error names the settings file" 'grep -qF "$CONF" <<< "$OU
check "and nothing was written" '[ ! -e "$WORK/home/.zshrc" ] && cmp -s "$CONF" "$DOTFILES/config.toml.example"'
check "--help lists --interactive" '"$DOTFILES/bootstrap.sh" --help | grep -q -- --interactive'
ix_run '' 'printf %s "$OMNISHELL_MIN_VERSION"'
check "omnishell 0.10.0 is the floor" '[ "$OUT" = 0.10.0 ]'
check "omnishell 0.11.0 is the floor" '[ "$OUT" = 0.11.0 ]'

echo ">> reloading settings"
fresh
Expand Down Expand Up @@ -137,7 +137,7 @@ check "both steps do nothing without --interactive" '[ "$RC" = 0 ] && gr

echo ">> docs"
check "the README names --interactive" 'grep -q -- "--interactive" "$DOTFILES/README.md"'
check "the README names the 0.10.0 floor" 'grep -q "omnishell 0.10.0 or newer" "$DOTFILES/README.md" && ! grep -q "0\.6\.0" "$DOTFILES/README.md"'
check "the README names the 0.11.0 floor" 'grep -q "omnishell 0.11.0 or newer" "$DOTFILES/README.md" && ! grep -q "0\.6\.0" "$DOTFILES/README.md"'
check "the template mentions --interactive" 'grep -q -- "--interactive" "$DOTFILES/config.toml.example"'

echo ">> modules: a declined selection does not linger"
Expand Down
14 changes: 7 additions & 7 deletions tests/test-omnishell-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ fail() { printf ' FAIL %s\n' "$1"; failures=$((failures + 1)); }
check() { if eval "$2"; then pass "$1"; else fail "$1"; fi; }

# the omnishell an upgrade would install
NEW_OMNISHELL="$WORK/omnishell-0.10.0"
printf '#!/bin/sh\n[ "$1" = version ] && echo "0.10.0 (commit abc, built now)"\n' > "$NEW_OMNISHELL"
NEW_OMNISHELL="$WORK/omnishell-0.11.0"
printf '#!/bin/sh\n[ "$1" = version ] && echo "0.11.0 (commit abc, built now)"\n' > "$NEW_OMNISHELL"
chmod +x "$NEW_OMNISHELL"

# a fresh stub dir (BIN) and HOME for each case
Expand Down Expand Up @@ -64,20 +64,20 @@ check "1.75.0 < 1.95 (different field counts)" '[ "$OUT" = no ]'

echo ">> install_omnishell: current version"
new_case current
omnishell_stub "$BIN" 0.10.0
omnishell_stub "$BIN" 0.11.0
stub curl 'exit 1'
run_fn install_omnishell
check "0.10.0 is kept" '[ "$RC" = 0 ] && grep -q "already installed (0.10.0" <<< "$OUT"'
check "0.11.0 is kept" '[ "$RC" = 0 ] && grep -q "already installed (0.11.0" <<< "$OUT"'
check "no installer was fetched" '! grep -q "^curl" "$CALLS"'

echo ">> install_omnishell: too old, curl installer upgrades it"
new_case upgrade
omnishell_stub "$BIN" 0.9.0 # the release just below the floor
omnishell_stub "$BIN" 0.10.0 # the release just below the floor
# the stub installer drops a newer omnishell into ~/.local/bin, which comes first on PATH
stub curl "echo 'mkdir -p \"\$HOME/.local/bin\"; cp \"$NEW_OMNISHELL\" \"\$HOME/.local/bin/omnishell\"'"
run_fn install_omnishell
check "old version triggers the upgrade" 'grep -q "^curl .*omnishell/main/install.sh" "$CALLS"'
check "reports the upgrade" 'grep -q "below the minimum 0.10.0" <<< "$OUT"'
check "reports the upgrade" 'grep -q "below the minimum 0.11.0" <<< "$OUT"'
check "run succeeds" '[ "$RC" = 0 ]'

echo ">> install_omnishell: too old and the upgrade does not help"
Expand All @@ -86,7 +86,7 @@ omnishell_stub "$BIN" 0.5.0
stub curl 'echo true'
run_fn install_omnishell
check "stops instead of carrying on" '[ "$RC" -ne 0 ]'
check "names the version and the fix" 'grep -q "0.5.0" <<< "$OUT" && grep -q "0.10.0" <<< "$OUT"'
check "names the version and the fix" 'grep -q "0.5.0" <<< "$OUT" && grep -q "0.11.0" <<< "$OUT"'

echo ">> install_omnishell: Homebrew upgrades it"
new_case brew
Expand Down
8 changes: 5 additions & 3 deletions tests/test-optional-parts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,14 @@ check "omnishell/config.toml enables dynamic-completion" 'module_enabled dynamic
check "dynamic-completion lists the self-completing CLIs" 'grep -qxF "commands = [\"terraform\", \"vault\", \"aws=aws_completer\", \"mc\"]" "$OMNISHELL_DEFAULT"'
check "ble-sh stays off (it conflicts with fzf)" '! grep -q "^\[modules\.ble-sh\]" "$OMNISHELL_DEFAULT"'
check "fzf stays enabled (navi requires it)" 'module_enabled fzf'
# omnishell validate only knows these modules from 0.10.0 on
if command -v omnishell >/dev/null 2>&1 && [ "$(printf '%s\n0.10.0\n' "$(omnishell version | awk '{print $1}')" | sort -V | head -n1)" = 0.10.0 ]; then
check "omnishell/config.toml enables zsh-edit-select" 'module_enabled zsh-edit-select'
check "zsh-edit-select configures Ghostty" 'awk "/^\[modules\.zsh-edit-select\.options\]/ {f=1; next} /^\[/ {f=0} f && /^terminal_ghostty = true/ {ok=1} END {exit !ok}" "$OMNISHELL_DEFAULT"'
# omnishell validate only knows these modules from 0.11.0 on
if command -v omnishell >/dev/null 2>&1 && [ "$(printf '%s\n0.11.0\n' "$(omnishell version | awk '{print $1}')" | sort -V | head -n1)" = 0.11.0 ]; then
mkdir -p "$WORK/validate/omnishell"; cp "$OMNISHELL_DEFAULT" "$WORK/validate/omnishell/config.toml"
check "omnishell validate accepts the default config" 'XDG_CONFIG_HOME="$WORK/validate" omnishell validate >/dev/null 2>&1'
else
echo " skip omnishell validate (omnishell 0.10.0 or newer not installed)"
echo " skip omnishell validate (omnishell 0.11.0 or newer not installed)"
fi

echo ">> main guards the generated config per stow package"
Expand Down
Loading