#!/usr/bin/env bash # # start-nvim.sh — launch Neovim with a minimal config that loads nuwiki. # # The plugin's install() downloads a pre-built release of nuwiki-ls for # your platform from the nuwiki-rs repository. On first launch a missing # binary is auto-downloaded via the bundled Vim script; set # NUWIKI_DEV_SKIP_BUILD=1 to skip the download entirely. # # Usage: ./development/start-nvim.sh [extra args...] # ./development/start-nvim.sh # open the scratch wiki's index # ./development/start-nvim.sh path/to/note.wiki # open a specific file # NUWIKI_DEV_WIKI=/tmp/foo ./development/start-nvim.sh # NUWIKI_DEV_NO_SEED=1 ./development/start-nvim.sh # use WIKI_DIR as-is (no scratch seeding) # NUWIKI_DEV_SKIP_BUILD=1 ./development/start-nvim.sh # skip the download step # # Each launch starts clean: the scratch wiki is reseeded from a pristine # copy and the editor state (cache/data/config) is wiped, so stale edits # never carry over. A wiki you point at with NUWIKI_DEV_WIKI is never wiped # (seeded only if empty). # # Tested with Neovim 0.10+. State (cache/data/config) lives under # $XDG_CACHE_HOME/nuwiki-dev/ so your real Neovim install stays # untouched. set -euo pipefail # Shared paths + helpers (log, ensure_binary, write_sample_wiki, seed_wiki). source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/_common.sh" INIT_FILE="$DEV_DIR/init.lua" STATE_DIR="$DEV_DIR/nvim-state" DATA_DIR="$DEV_DIR/nvim-data" CONFIG_DIR="$DEV_DIR/nvim-config" write_init() { mkdir -p "$DEV_DIR" cat > "$INIT_FILE" <