gffranco 047c9a3cf3
CI / cargo fmt --check (push) Successful in 17s
CI / cargo clippy (push) Successful in 1m7s
CI / cargo test (push) Successful in 1m13s
fix(vim): follow-link creates missing pages + safe LSP foldexpr
Two user-visible bugs:

1. `<CR>` on a wikilink whose target wasn't indexed yet (typical for
   "follow this link → page doesn't exist → I want a fresh buffer for
   it") did nothing. Cause: `Backend::resolve_target_uri` returned
   `None` once `WorkspaceIndex::resolve` came up empty, so
   `goto_definition` had no Location to hand back to the client and
   `vim.lsp.buf.definition()` / `:LspDefinition` silently no-op'd.

   Vimwiki's behaviour is "open a fresh buffer for the future page".
   `Backend::resolve_target_uri` now synthesises a
   `<wiki_root>/<path><file_extension>` URI when the lookup misses,
   for both `LinkKind::Wiki` and the `LinkKind::Interwiki` fallback.
   The editor opens an empty buffer; saving writes the file. New
   helper `synthesise_page_uri` does the path walk so subdirectory
   wikilinks like `[[notes/Daily]]` get the right output path.

2. Folding occasionally surfaced an `E5108` from inside
   `vim.lsp.foldexpr()` — happens when the function fires before the
   LSP client has finished attaching to the buffer, or when the
   server's `foldingRange` response hasn't yet arrived. The error
   gets shouted once per visible line.

   `lua/nuwiki/folding.lua` now exports `lsp_expr` which `pcall`s
   `vim.lsp.foldexpr` and falls back to the regex implementation
   (`M.expr`) on error or when the LSP function isn't available.
   `ftplugin.lua` points `foldexpr` at the wrapper instead of
   `vim.lsp.foldexpr` directly. `foldtext` is set in both branches
   now so collapsed folds keep the nicer summary line.

Tests: 4 new in `phase19_followlink_creates.rs` covering indexed
resolution, missing-page fallback, the canonical
`<root>/<page>.wiki` shape, and the slash-bearing subdirectory link.
Total 381 tests pass; fmt + clippy clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 01:22:35 +00:00
2026-05-11 21:57:05 +00:00
2026-05-11 21:57:05 +00:00

nuwiki

A Vim/Neovim plugin providing full vimwiki syntax support, implemented as a Rust-based language server (LSP).

Status: v1.0 (Phases 010) shipped — parsing, highlighting, navigation, editor glue, and release pipeline are all live. v1.1 (Phases 1119) in progress, closing the gap to a full vimwiki replacement: tags, diary, server-side edit commands, link health, HTML export commands, multi-wiki, and the :Vimwiki* keymap layer.

See SPEC.md for the full project specification.

Implementation status

v1.0 — foundation

Phase Name Status
0 Scaffolding done
1 Core AST done
2 Syntax Plugin Interface done
3 Vimwiki Lexer done
4 Vimwiki Parser done
5 Renderer done
6 LSP Foundation done
7 Semantic Tokens done
8 Navigation done
9 Editor Glue done
10 CI/CD release pipeline done

v1.1 — full vimwiki replacement

Phase Name Status
11 Plumbing prerequisites done
12 Tags done
13 Workspace edits + executeCommand done
14 List & table edit commands done (focused subset; table/list-renumber/colorize deferred)
15 Link health + TOC/index generation done
16 Diary done
17 HTML export commands done
18 Multi-wiki done
19 Editor glue v2 (:Vimwiki* compat, keymaps, text objects, folding) done

Repository layout

nuwiki/
├── Cargo.toml              workspace root
├── crates/
│   ├── nuwiki-core/        parser, AST, renderer (no editor deps)
│   ├── nuwiki-lsp/         LSP protocol bridge
│   └── nuwiki-ls/          binary that speaks LSP over stdio
├── plugin/                 universal Vim/Neovim entry point
├── lua/nuwiki/             Neovim Lua glue
├── autoload/nuwiki/        Vim VimL glue
├── ftdetect/               filetype detection for .wiki
├── ftplugin/               per-buffer filetype settings
├── syntax/                 static fallback highlighting
├── doc/                    `:h nuwiki`
├── scripts/                build-time helpers
└── .gitea/workflows/       CI / release pipelines

Building

cargo build --workspace
cargo test  --workspace

MSRV: Rust 1.83.

License

Dual-licensed under either of:

at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this work shall be dual licensed as above, without any additional terms or conditions.

S
Description
No description provided
Readme 1.1 MiB
v0.5.2 Latest
2026-07-02 12:02:20 +00:00
Languages
Vim Script 49.1%
Lua 36.7%
Shell 11.2%
HTML 3%