diff --git a/README.md b/README.md index 9828b62..bae653a 100644 --- a/README.md +++ b/README.md @@ -22,14 +22,14 @@ nothing is configured twice: | 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.` | +| **[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.` | | **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 @@ -37,8 +37,9 @@ source build where no distro package exists, 0.7.0 is the first with 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 @@ -80,11 +81,11 @@ exec $SHELL `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 @@ -388,6 +389,7 @@ omnishell doctor # check for drift / degraded modules | `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 | - | @@ -398,6 +400,13 @@ omnishell doctor # check for drift / degraded modules | `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 diff --git a/bootstrap.sh b/bootstrap.sh index 7d2934e..ca4db55 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -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), diff --git a/omnishell/config.toml b/omnishell/config.toml index 6b689fc..6738ba8 100644 --- a/omnishell/config.toml +++ b/omnishell/config.toml @@ -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] diff --git a/tests/test-interactive.sh b/tests/test-interactive.sh index 4e695fd..319604e 100644 --- a/tests/test-interactive.sh +++ b/tests/test-interactive.sh @@ -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 @@ -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" diff --git a/tests/test-omnishell-toolchain.sh b/tests/test-omnishell-toolchain.sh index 92102bd..60476f7 100644 --- a/tests/test-omnishell-toolchain.sh +++ b/tests/test-omnishell-toolchain.sh @@ -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 @@ -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" @@ -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 diff --git a/tests/test-optional-parts.sh b/tests/test-optional-parts.sh index 9cec039..87f9610 100755 --- a/tests/test-optional-parts.sh +++ b/tests/test-optional-parts.sh @@ -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"