dev: start-* launchers always start from a clean setup
The launchers reused whatever was left under $XDG_CACHE_HOME/nuwiki-dev between runs — seed_wiki() skipped reseeding when index.wiki already existed, so stale edits from a previous session leaked into the next, and old swap/viminfo/coc state carried over. Each launch now starts clean: - seed_wiki() reseeds the managed scratch wiki from a pristine copy every run (rm -rf + write_sample_wiki). A user-pointed NUWIKI_DEV_WIKI is never wiped — it's seeded only when empty, so a real wiki is never clobbered. NUWIKI_DEV_NO_SEED still bypasses seeding entirely. - new reset_dirs() helper wipes + recreates each launcher's owned state dirs (vim viminfo/swap/undo, coc data, nvim XDG state/data/config) before launch. Cached plugin clones (vim-lsp, async.vim, coc.nvim) are kept — only the wiki and editor state are reset. Header docs updated to describe the fresh-each-launch behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,11 @@
|
||||
# the running LSP. `cargo build --release` is incremental, so this is a fast
|
||||
# no-op when nothing changed. Set NUWIKI_DEV_SKIP_BUILD=1 to skip the build.
|
||||
#
|
||||
# Each launch starts clean: the scratch wiki is reseeded from a pristine
|
||||
# copy and the editor state (viminfo/swap/undo, coc data) is wiped, so stale
|
||||
# edits never carry over. The cached coc.nvim clone is kept. A wiki you point
|
||||
# at with NUWIKI_DEV_WIKI is never wiped (seeded only if empty).
|
||||
#
|
||||
# Tested with Vim 9.1+ and Node 18+. State (viminfo/sessions, coc data) lives
|
||||
# under $XDG_CACHE_HOME/nuwiki-dev/ so your real Vim install stays untouched.
|
||||
|
||||
@@ -165,6 +170,7 @@ main() {
|
||||
write_coc_settings
|
||||
seed_wiki
|
||||
write_vimrc
|
||||
reset_dirs "$VIM_STATE" "$COC_DATA"
|
||||
mkdir -p "$VIM_STATE/swap" "$VIM_STATE/backup" "$VIM_STATE/undo" "$COC_DATA"
|
||||
|
||||
log "launching: vim --clean -u $VIMRC"
|
||||
|
||||
Reference in New Issue
Block a user