Skip to content

Releases: mohseenrm/marko.nvim

v2.0.0

01 Dec 07:42
0bbb097

Choose a tag to compare

v2.0.0 Rewrite Using Native ShaDa System

Overview

Rewrites marko.nvim to leverage Neovim's native ShaDa (shared data) system instead of custom YAML configuration files. This provides better reliability, simpler code, and tighter integration with Neovim.

🚀 Why This Change?

The v1.x implementation fought against Neovim's built-in ShaDa system, causing:

  • Race conditions during startup/shutdown
  • Complex path matching logic (6+ different comparison methods)
  • Manual mark filtering that was prone to bugs
  • Timing issues with UIEnter and VimLeave autocmds

✨ Key Improvements

1. Native ShaDa Integration

  • Uses project-specific ShaDa files at ~/.local/state/nvim/marko/
  • Neovim handles all loading, saving, merging, and error recovery
  • No more race conditions or timing issues

2. Massive Code Simplification

  • 70% code reduction: From ~933 lines to ~217 lines
  • Removed 5 modules (config, file, utils, yaml, parser)

3. True Project Isolation

  • Marks are truly isolated - they don't exist in other projects
  • Based on absolute working directory path (no ambiguity)
  • Each project gets its own ShaDa file

4. Better User Experience

  • New :MarkoInfo command shows project details and marks
  • New :MarkoList command lists all project ShaDa files
  • More intuitive commands

📋 Changes

Added

  • :MarkoInfo - Display current project directory, ShaDa file location, and all active marks
  • :MarkoList - List all project-specific ShaDa files managed by Marko
  • :MarkoClean - Delete ShaDa file for current project (with confirmation)
  • MIGRATION.md - Detailed migration guide
  • CHANGELOG.md - Version history

Changed

  • Complete rewrite of lua/marko/init.lua
  • Project detection now uses absolute working directory path
  • Marks stored in native ShaDa format instead of YAML
  • ShaDa files stored in ~/.local/state/nvim/marko/ (standard location)

Removed

  • :MarkoReload command (no longer needed)
  • :MarkoDeleteConfig command (replaced by :MarkoClean)
  • :MarkoDebug command (replaced by :MarkoInfo)
  • Custom YAML configuration file
  • Modules: config.lua, file.lua, utils.lua, yaml.lua, parser.lua (now deprecated stubs)

🔧 Technical Details

Before (v1.x)

-- Custom YAML config
~/.local/share/nvim/marko/config.yaml

-- Manual lifecycle
UIEnter -> Clear marks -> Load from YAML -> Filter by path
VimLeave -> Get marks -> Filter by path -> Save to YAML

After (v2.0)

-- Native ShaDa per project
~/.local/state/nvim/marko/marko_<project_id>.shada

-- Simple lifecycle
setup() -> Set shadafile option -> Load ShaDa
VimLeavePre -> Save ShaDa (automatic)

📊 Code Comparison

Metric v1.x v2.0 Change
Total lines ~933 ~217 -77%
Number of modules 6 1 -83%
Path comparison methods 6+ 1 -83%
Autocmds 5+ 1 -80%

⚠️ Breaking Changes

Configuration

  • Old: ~/.local/share/nvim/marko/config.yaml
  • New: ~/.local/state/nvim/marko/marko_<project_id>.shada

Commands

  • :MarkoReload → Removed (ShaDa handles reloading)
  • :MarkoDeleteConfig:MarkoClean (renamed)
  • :MarkoDebug:MarkoInfo (renamed and improved)

Migration

  • Old YAML marks are not automatically migrated
  • Users should recreate important marks manually after upgrade
  • See MIGRATION.md for details

✅ Testing

New basic test suite verifies:

  • ✅ Module loads successfully
  • ✅ ShaDa path generation
  • ✅ Project isolation
  • ✅ Path consistency

Run with: lua tests/basic_test.lua

Note: Existing tests need updating for new architecture (tracked separately).

📚 Documentation

  • README.md - Completely rewritten to explain new approach
  • MIGRATION.md - Step-by-step migration guide for v1.x users
  • CHANGELOG.md - Version history and breaking changes

🔄 Migration Guide

See MIGRATION.md for full details.