A local-first code snippet manager with multi-language syntax highlighting, WebDAV sync, and system tray integration.
SnipVault is a desktop snippet manager designed for developers to quickly capture, edit, and retrieve reusable code fragments.
It follows a focused two-pane workflow:
- Left pane: snippet list with full-text search, language filter, and favorites filter
- Right pane: syntax-highlighted editor with title/description, tag chips (Enter to create or choose from suggestions), favorite toggle, one-click copy, and an IDE-style codeglance minimap (click-to-jump + draggable viewport)
The app is local-first by default (SQLite, fully usable offline). If you need multi-device usage, you can enable WebDAV two-way merge sync.
| Home View (Dark Theme) | Home View (Light Theme) |
|---|---|
![]() |
![]() |
| Settings (Dark Theme) | Settings (Light Theme) |
|---|---|
![]() |
![]() |
- Multi-language syntax highlighting — JavaScript/TypeScript, Python, Rust, Java, C/C++/C#, PHP, SQL, HTML/CSS, JSON, Markdown, YAML, and more
- Full-text search — Search by title, content, description, or tags with language/tag filtering
- Tag system — Organize snippets with tag chips (press Enter to create or pick from suggestions)
- Favorites — Mark important snippets for quick access
- Copy to clipboard — One-click copy with system tray integration
- Codeglance minimap — Right-side canvas minimap with click-to-jump and draggable viewport, using the editor as the single source of scroll behavior
- Import/Export — JSON format for backup and portability; export defaults to
Downloads/SnipVaultwhen available - Dark/Light/System theme — Follow system preference or pick manually
- WebDAV sync — Bi-directional merge sync with any WebDAV-compatible cloud storage (Nextcloud, Synology, Nutstore, etc.)
- Auto-sync — Configurable background sync interval
- System tray — Minimize to tray, quick access menu, background operation
- Auto-start — Launch on system boot (Windows/macOS)
- Offline-first — All data stored locally in SQLite; works without internet
- Added WebDAV auth mode selector (
Auto,Basic,Digest,Bearer,None) with default set toAuto (Digest→Basic) - Improved export UX: single success dialog with direct “Open folder” action
- Updated shell open permissions so exported local folders can be opened directly
- Refined editor layout defaults (narrower list/minimap for more coding area)
- Improved left preview code block height for 3-line visibility
| Layer | Technology |
|---|---|
| Framework | Tauri 2 (Rust backend + WebView frontend) |
| Frontend | React 19 + TypeScript + Vite |
| Editor | CodeMirror 6 (@uiw/react-codemirror) |
| Database | SQLite via rusqlite (bundled) |
| Sync | WebDAV via reqwest (blocking HTTP) |
JavaScript · TypeScript · JSX/TSX · Python · Rust · Java · C · C++ · C# · PHP · SQL · HTML · XML · CSS · JSON · Markdown · YAML
Prerequisites
- Node.js 18+
- Rust 1.70+ (
rustup default stable) - Windows: Visual Studio Build Tools with C++ workload
# Clone the repository
git clone https://github.com/rainerosion/snipvault.git
cd snipvault
# Install frontend dependencies
npm install
# Development mode
npm run tauri dev
# Production build
npm run tauri buildDownload from the Releases page:
| Platform | Format | Notes |
|---|---|---|
| Windows | .msi / .exe (NSIS) |
x64 installer |
| macOS | .dmg |
Universal binary (Intel + Apple Silicon) |
| Linux | .deb / .AppImage |
amd64 |
| Mode | Location |
|---|---|
| Portable (default) | %LOCALAPPDATA%/SnipVault/ (Windows) |
| Installed (MSI/NSIS) | <exe_dir>/data/ |
If <exe_dir>/data/ is not writable, SnipVault automatically falls back to %APPDATA%/SnipVault/.
Files: snippets.db (SQLite), settings.json
Configure any WebDAV-compatible server in Settings → WebDAV Sync:
- Server URL — e.g.
https://your-server.com/remote.php/dav/files/username/ - Username / Password or API Key
- Auth mode —
Auto (Digest→Basic)/Basic/Digest/Bearer token/No auth - Enable Auto-sync and set the interval (5 min / 15 min / 30 min / 1 hour / 2 hours)
Tip: use a writable WebDAV directory URL (not service homepage URL). On sync, SnipVault will automatically prepare the
snipvault/directory when the provider allows it.
Sync is incremental: only newer snippets (by updated_at) are merged from both sides.
| Shortcut | Action |
|---|---|
Ctrl+N |
New snippet |
Ctrl+S |
Save snippet |
Ctrl+E |
Export all snippets |
src-tauri/
src/
main.rs — Entry point, tray, window management, auto-sync timer
lib.rs — Module root
commands.rs — All #[tauri::command] IPC handlers
db.rs — SQLite CRUD, merge logic, sync history
settings.rs — Settings struct + JSON persistence
paths.rs — Data dir detection (portable vs installed)
webdav.rs — WebDAV upload/download/merge
Cargo.toml
tauri.conf.json
src/
main.tsx — ThemeProvider context
App.tsx — Root layout, state management, keyboard shortcuts
components/
Toolbar.tsx — Top bar: search, filters, sync, settings
Sidebar.tsx — Snippet list with language/favorite filtering
SnippetEditor.tsx — CodeMirror 6 editor with syntax highlighting
Settings.tsx — Settings modal panel
Dialog.tsx — Alert/confirm/ask dialog
hooks/
useSnippets.ts — CRUD + Tauri IPC
useSettings.ts — Settings + sync + autostart IPC
utils/languages.ts — Language config: colors, names, CM extensions
public/fonts/ — Bundled Outfit + JetBrains Mono fonts
Issues and pull requests are welcome! Please read the code conventions in CLAUDE.md before contributing.
灵藏 · SnipVault 是一款面向开发者的桌面代码片段管理工具,用于高效沉淀、检索和复用常用代码。
核心使用方式是双栏工作流:
- 左侧:片段列表,支持全文搜索、语言筛选、收藏筛选
- 右侧:语法高亮编辑区,支持标题/描述、标签 chip(回车创建或下拉建议选择)、收藏切换、一键复制,以及 IDE 风格 codeglance(点击跳转 + 视窗拖拽)
应用默认本地优先(SQLite 离线可用);需要多端同步时可启用 WebDAV 双向合并同步。
| 主页(深色主题) | 主页(浅色主题) |
|---|---|
![]() |
![]() |
| 设置(深色主题) | 设置(浅色主题) |
|---|---|
![]() |
![]() |
- 多语言语法高亮 — JavaScript/TypeScript、Python、Rust、Java、C/C++/C#、PHP、SQL、HTML/CSS、JSON、Markdown、YAML 等
- 全文搜索 — 按标题、内容、描述、标签搜索,支持语言/收藏过滤
- 标签系统 — 支持标签 chip(回车创建或下拉建议选择)
- 收藏功能 — 标记重要片段快速访问
- 一键复制 — 代码片段复制到剪贴板,配合系统托盘使用
- Codeglance 预览 — 右侧 Canvas 代码预览,支持点击跳转与视窗拖拽,并以编辑器滚动条作为唯一滚动逻辑来源
- 导入/导出 — JSON 格式备份与迁移;导出优先保存到
Downloads/SnipVault - 暗色/亮色/跟随系统 — 三种主题模式
- WebDAV 同步 — 与任意 WebDAV 兼容云盘双向合并同步(Nextcloud、群晖、坚果云等)
- 自动同步 — 可配置后台同步间隔
- 系统托盘 — 最小化到托盘、快捷菜单、后台运行
- 开机自启 — 开机自动启动(Windows/macOS)
- 离线优先 — 数据全量存储在本地 SQLite,无网也能用
- 新增 WebDAV 认证方式选择(
Auto、Basic、Digest、Bearer、无认证),默认Auto(Digest→Basic) - 优化导出交互:成功后单弹窗即可直接“打开目录”
- 修复本地导出目录打开权限,支持直接拉起系统文件管理器
- 调整编辑器布局默认宽度(缩小左右两栏,提升中间编辑区可视面积)
- 提升左侧列表代码预览高度,3 行内容显示更完整
| 层级 | 技术 |
|---|---|
| 框架 | Tauri 2(Rust 后端 + WebView 前端) |
| 前端 | React 19 + TypeScript + Vite |
| 编辑器 | CodeMirror 6(@uiw/react-codemirror) |
| 数据库 | SQLite(通过 rusqlite,bundled) |
| 同步 | WebDAV(通过 reqwest,blocking HTTP) |
JavaScript · TypeScript · JSX/TSX · Python · Rust · Java · C · C++ · C# · PHP · SQL · HTML · XML · CSS · JSON · Markdown · YAML
环境要求
- Node.js 18+
- Rust 1.70+(
rustup default stable) - Windows:需要 Visual Studio Build Tools(C++ 工作负载)
# 克隆仓库
git clone https://github.com/rainerosion/snipvault.git
cd snipvault
# 安装前端依赖
npm install
# 开发模式
npm run tauri dev
# 生产构建
npm run tauri build从 Releases 下载:
| 平台 | 格式 | 说明 |
|---|---|---|
| Windows | .msi / .exe (NSIS) |
x64 安装包 |
| macOS | .dmg |
通用二进制(Intel + Apple Silicon) |
| Linux | .deb / .AppImage |
amd64 |
| 模式 | 路径 |
|---|---|
| 便携模式(默认) | %LOCALAPPDATA%/SnipVault/(Windows) |
| 安装模式(MSI/NSIS) | <exe所在目录>/data/ |
如果 <exe所在目录>/data/ 不可写,SnipVault 会自动回退到 %APPDATA%/SnipVault/。
存储文件:snippets.db(SQLite 数据库)、settings.json(配置文件)
在 设置 → WebDAV 同步 中配置:
- 服务器地址 — 例如
https://your-server.com/remote.php/dav/files/username/ - 用户名 / 密码或 API Key
- 认证方式 —
自动(Digest→Basic)/Basic/Digest/Bearer Token/无认证 - 开启 自动同步 并设置间隔(5 分钟 / 15 分钟 / 30 分钟 / 1 小时 / 2 小时)
提示:请填写“可写的 WebDAV 目录 URL”,不要填网盘首页地址。同步时,SnipVault 会在服务端允许的情况下自动准备
snipvault/目录。
同步为增量合并:仅传输双方中较新的片段(按 updated_at 时间戳判断)。
| 快捷键 | 功能 |
|---|---|
Ctrl+N |
新建片段 |
Ctrl+S |
保存片段 |
Ctrl+E |
导出所有片段 |
灵藏 · SnipVault/
├── src-tauri/ # Rust 后端(Tauri 2)
│ ├── src/
│ │ ├── main.rs # 入口,托盘,窗口关闭行为,自动同步定时器
│ │ ├── lib.rs # 模块根
│ │ ├── commands.rs # 所有 #[tauri::command] IPC 命令
│ │ ├── db.rs # SQLite CRUD、合并逻辑、同步历史
│ │ ├── settings.rs # 设置结构体与 JSON 持久化
│ │ ├── paths.rs # 数据目录检测(便携 vs 安装模式)
│ │ └── webdav.rs # WebDAV 上传/下载/合并
│ ├── Cargo.toml
│ ├── tauri.conf.json
│ └── icons/ # 应用图标
├── src/ # React 前端
│ ├── main.tsx # ThemeProvider 上下文
│ ├── App.tsx # 根组件,状态管理,快捷键
│ ├── index.css # 全局样式
│ ├── components/
│ │ ├── Toolbar.tsx # 顶部工具栏
│ │ ├── Sidebar.tsx # 片段列表
│ │ ├── SnippetEditor.tsx # CodeMirror 6 编辑器
│ │ ├── Settings.tsx # 设置弹窗面板
│ │ └── Dialog.tsx # 提示/确认/选择对话框
│ ├── hooks/
│ │ ├── useSnippets.ts # CRUD + Tauri IPC
│ │ └── useSettings.ts # 设置 + 同步 + 开机自启 IPC
│ └── utils/
│ └── languages.ts # 语言配置:颜色、名称、CM 扩展映射
├── public/fonts/ # 本地字体(Outfit + JetBrains Mono)
├── CLAUDE.md # Claude Code 开发指南
├── README.md # 本文档
└── package.json
欢迎提交 Issue 和 Pull Request!贡献前请阅读 CLAUDE.md 中的代码规范。



