2026-05-30 18:35:40 +00:00
# nuwiki Developer Onboarding
## Overview
nuwiki is a vimwiki-compatible Vim/Neovim plugin backed by a Rust language server. It provides full vimwiki syntax support while keeping the original file format, keymaps, and command surface intact. The substantive work happens in a Rust LSP daemon — Vim and Neovim are thin client layers that wire up keystrokes and display results.
2026-06-24 12:57:15 +00:00
The Rust LSP server lives in the separate [nuwiki-rs ](https://code.gfran.co/gffranco/nuwiki-rs ) repository. This plugin repo is the Vim/Neovim client layer and is distributed independently from the server binary.
2026-05-30 18:35:40 +00:00
## Repository Structure
```
nuwiki/
├── plugin/ # Universal Vim/Neovim entry point
│ └── nuwiki.vim
│
├── lua/ # Neovim-specific Lua layer
│ └── nuwiki/
│ ├── init.lua
│ ├── config.lua
│ ├── lsp.lua
2026-06-24 12:57:15 +00:00
│ └── install.lua # Binary download logic
2026-05-30 18:35:40 +00:00
│
├── autoload/ # Lazy-loaded VimL (Vim compat layer)
│ └── nuwiki/
│ └── lsp.vim
│
├── ftdetect/ # Filetype detection for .wiki files
│ └── nuwiki.vim
│
├── ftplugin/ # Per-filetype buffer settings
│ └── nuwiki.vim
│
├── syntax/ # Static fallback syntax highlighting (no LSP required)
│ └── nuwiki.vim
│
├── doc/ # Vim help documentation
│ └── nuwiki.txt
│
├── scripts/ # Plugin-runtime scripts only
│ └── download_bin.vim # VimL binary download (used by Dein/vim-plug build hooks)
│
├── development/ # Developer-only tooling and docs (not shipped)
│ ├── ONBOARDING.md # This file
│ ├── SPEC.md # Technical reference (architecture, LSP, commands)
│ ├── nuwiki-architecture.html
│ ├── start-nvim.sh # Launch Neovim against a generated sample wiki
│ ├── start-vim.sh # Launch Vim against a generated sample wiki
│ ├── syntax-diag.vim # Dump highlighting state for debugging
│ └── tests/ # Editor keymap/command harnesses (run in CI)
│ ├── test-keymaps.sh # Neovim keymap harness
│ ├── test-keymaps.lua
│ ├── test-keymaps-vim.sh # Vim keymap harness
2026-05-31 21:45:50 -03:00
│ ├── test-keymaps-vim.vim
│ ├── test-calendar.sh # Neovim calendar-vim integration harness
│ ├── test-calendar.lua
│ ├── test-calendar-vim.sh # Vim calendar-vim integration harness
│ ├── test-calendar-vim.vim
│ └── test-calendar-vim-optout.vim
2026-05-30 18:35:40 +00:00
│
└── .gitea/
└── workflows/
2026-06-24 15:42:27 +00:00
└── ci.yaml # Editor (Vim/Neovim) harnesses on every push/PR
2026-05-30 18:35:40 +00:00
```
2026-06-24 15:42:27 +00:00
(The Rust server's build/release workflow lives in the separate
[nuwiki-rs ](https://code.gfran.co/gffranco/nuwiki-rs ) repository.)
2026-06-24 12:57:15 +00:00
## Server Component
The Rust LSP server (`nuwiki-ls` ) lives in the separate [nuwiki-rs ](https://code.gfran.co/gffranco/nuwiki-rs ) repository. Pre-built binaries are downloaded automatically by the plugin's `install()` function. To build from source:
2026-05-30 18:35:40 +00:00
2026-06-24 12:57:15 +00:00
``` bash
git clone https://code.gfran.co/gffranco/nuwiki-rs
cd nuwiki-rs
cargo build --release -p nuwiki-ls
```
2026-05-30 18:35:40 +00:00
## Build & Installation
### Prerequisites
- For editor integration: Vim 9+ or Neovim 0.5+ with an LSP client (vim-lsp recommended for Vim, built-in for Neovim 0.11+)
2026-06-24 12:57:15 +00:00
- The `nuwiki-ls` binary is downloaded automatically; no Rust toolchain required unless building from source
2026-05-30 18:35:40 +00:00
### Installation via Plugin Managers
#### lazy.nvim
``` lua
{
' gffranco/nuwiki ' ,
build = " :lua require('nuwiki').install() " ,
ft = { ' vimwiki ' } ,
opts = {
wiki_root = ' ~/vimwiki ' ,
} ,
}
```
#### vim-plug
``` vim
Plug 'gffranco/nuwiki' , { 'do' : 'vim -e -s -c \"source scripts/download_bin.vim\" -c \"q\"' }
```
#### Dein
``` vim
call dein #add ( 'gffranco/nuwiki' , {
\ 'build' : 'vim -e -s -c \"source scripts/download_bin.vim\" -c \"q\"'
\ })
```
### Manual Installation (Plain Vim)
``` bash
git clone https://code.gfran.co/gffranco/nuwiki ~/.vim/pack/gffranco/start/nuwiki
cd ~/.vim/pack/gffranco/start/nuwiki
2026-06-24 12:57:15 +00:00
vim -e -s -c "source scripts/download_bin.vim" -c "q"
2026-05-30 18:35:40 +00:00
```
Plain Vim users also need an LSP client — vim-lsp is recommended.
## Development Workflow
2026-06-24 12:57:15 +00:00
### Testing (Editor Layer)
2026-05-30 18:35:40 +00:00
2026-06-24 12:57:15 +00:00
``` bash
# Run editor tests (shell + Lua harnesses in development/tests/)
./development/tests/test-keymaps.sh
./development/tests/test-calendar.sh
2026-05-30 18:35:40 +00:00
```
2026-06-24 12:57:15 +00:00
For Rust-level tests, see the [nuwiki-rs ](https://code.gfran.co/gffranco/nuwiki-rs ) repository:
2026-05-30 18:35:40 +00:00
2026-06-24 12:57:15 +00:00
``` bash
# In the nuwiki-rs repo
cargo test --workspace
2026-05-30 18:35:40 +00:00
cargo clippy --workspace -- -D warnings
```
### Running the LSP Server Manually (for debugging)
2026-06-24 12:57:15 +00:00
Build from [nuwiki-rs ](https://code.gfran.co/gffranco/nuwiki-rs ) and run:
2026-05-30 18:35:40 +00:00
``` bash
cargo run -p nuwiki-ls -- --help
```
The LSP server communicates over stdio. You can test it with an LSP client like `lspci` or by connecting from Neovim.
### Health Check (Neovim)
After installing the plugin, run:
```
:checkhealth nuwiki
```
This verifies:
- Binary exists at `{plugin_dir}/bin/nuwiki-ls`
- Binary is executable and responds to `--version`
- LSP client is running
- Filetype detection works for `.wiki` files
## Editor Layers
### VimL Layer (`plugin/nuwiki.vim`, `autoload/`)
- Universal entry point for all plugin managers
- Detects whether running in Neovim or Vim
- For Neovim: delegates to Lua layer
- For Vim: starts the LSP server via `nuwiki#lsp#start()`
### Neovim Lua Layer (`lua/nuwiki/`)
- `init.lua` : Main setup function
- `config.lua` : Configuration schema and defaults
- `lsp.lua` : Starts the LSP client using `vim.lsp.start()`
- `install.lua` : Handles binary download/build and places it in the plugin's `bin/` directory
### Vim Compatibility Layer (`autoload/nuwiki/lsp.vim`)
- Provides the `nuwiki#lsp#start()` function for Vim
- Handles binary location and LSP client startup via vim-lsp or coc.nvim
## Important Notes
2026-06-24 12:57:15 +00:00
- The Rust LSP server is in the separate [nuwiki-rs ](https://code.gfran.co/gffranco/nuwiki-rs ) repository.
- This plugin repo contains only the editor client layer (VimL/Lua).
2026-05-30 18:35:40 +00:00
- Editor layers (VimL/Lua) contain zero logic — they are pure wiring only.
2026-06-24 12:57:15 +00:00
- All syntax-specific code lives in the Rust LSP server's `nuwiki-core` crate.
2026-05-30 18:35:40 +00:00
## Getting Started
2026-06-24 12:57:15 +00:00
1. Clone this plugin repository:
```bash
git clone https://code.gfran.co/gffranco/nuwiki
cd nuwiki
` ``
2026-05-30 18:35:40 +00:00
2026-06-24 12:57:15 +00:00
2. Install the plugin in your Neovim/Vim configuration using your preferred plugin manager (see above examples). The ` nuwiki-ls` binary will be downloaded automatically.
2026-05-30 18:35:40 +00:00
2026-06-24 12:57:15 +00:00
3. Open a .wiki file and verify:
- Syntax highlighting works
- ` :VimwikiIndex` opens the index page
- LSP features (go-to-definition, hover, completions) work via ` :checkhealth nuwiki`
2026-05-30 18:35:40 +00:00
2026-06-24 12:57:15 +00:00
To modify the LSP server itself, clone the [nuwiki-rs](https://code.gfran.co/gffranco/nuwiki-rs) repository and build the binary from source.
2026-05-30 18:35:40 +00:00
## CI/CD
2026-06-24 12:57:15 +00:00
This repo (editor client) uses Gitea Actions:
- CI (` .gitea/workflows/ci.yaml`): Runs editor tests on every push/PR.
The Rust LSP server lives in [nuwiki-rs](https://code.gfran.co/gffranco/nuwiki-rs) which handles:
- Release (` .gitea/workflows/release.yaml`): Triggers on ` v*` tag — cross-compiles for Linux targets and creates a Gitea release with downloadable binaries.
2026-05-30 18:35:40 +00:00
2026-06-24 15:42:27 +00:00
### Releasing the plugin
This repo has no release workflow — the plugin is distributed by plugin
managers cloning the git repo, so a "release" is just a git tag. There is no
automated version stamping (the old ` scripts/set-version.sh` moved to
nuwiki-rs with the Rust crates), so cut a plugin release by hand:
1. Bump ` g:nuwiki_version` in ` plugin/nuwiki.vim`.
2. Commit, then ` git tag vX.Y.Z && git push --tags`.
The plugin and the ` nuwiki-ls` server version independently; the binary is
fetched from nuwiki-rs's ` latest` release at install time.
2026-05-30 18:35:40 +00:00
## License
Dual-licensed under MIT or Apache-2.0 at your option.