Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
name: Vimlet
on: [push, pull_request]
on:
push:
branches-ignore: [main]
pull_request:
workflow_call:
workflow_dispatch:

permissions:
contents: read
jobs:
rust:
runs-on: ubuntu-latest
Expand All @@ -9,6 +17,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install 1.90.0 --profile minimal
- uses: Swatinem/rust-cache@e9d7b9f1e587218970671bac74e5511ed9506e6a # v2
with:
key: ${{ matrix.features }}
- run: cargo +1.90.0 test --locked ${{ matrix.features }}
- run: cargo clippy --locked --all-targets ${{ matrix.features }} -- -D warnings
- run: cargo doc --locked --no-deps ${{ matrix.features }}
Expand All @@ -19,6 +30,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@e9d7b9f1e587218970671bac74e5511ed9506e6a # v2
with:
key: reference
- run: |
curl --fail --location --output "$RUNNER_TEMP/nvim.tar.gz" https://github.com/neovim/neovim/releases/download/v0.12.1/nvim-linux-x86_64.tar.gz
tar -xzf "$RUNNER_TEMP/nvim.tar.gz" -C "$RUNNER_TEMP"
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Release
on:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false

jobs:
checks:
uses: ./.github/workflows/ci.yml

publish:
needs: checks
if: github.repository == 'codersauce/vimlet' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@e9d7b9f1e587218970671bac74e5511ed9506e6a # v2
- uses: release-plz/action@f5380069c7ca03fe7466630c5012feb28d84373c # release-plz 0.4.2
with:
command: release
version: 0.4.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release-pr:
needs: publish
if: github.repository == 'codersauce/vimlet' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
actions: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@e9d7b9f1e587218970671bac74e5511ed9506e6a # v2
- uses: release-plz/action@f5380069c7ca03fe7466630c5012feb28d84373c # release-plz 0.4.2
id: release
with:
command: release-pr
version: 0.4.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# PRs created with GITHUB_TOKEN do not trigger pull_request workflows.
- name: Run CI on the release PR
if: steps.release.outputs.prs_created == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCH: ${{ fromJSON(steps.release.outputs.pr).head_branch }}
run: gh workflow run ci.yml --ref "$RELEASE_BRANCH"
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Changelog

Notable changes to Vimlet. Each release uses the same notes here and on GitHub.

## [0.2.0](https://github.com/codersauce/vimlet/releases/tag/v0.2.0) — 2026-10-28

Vimlet 0.2 adds host-dispatched macros and improves repeat, Visual editing, and undo grouping.

### Breaking changes

- Extend the public `Key`, `Operator`, `Action`, and `Motion` enums. Update exhaustive matches to handle `Key::Named`, `Operator::Comment`, `Action::SelectTarget`, `Action::SwapVisualHorizontal`, and `Motion::NextLineFirstNonBlank`. Numeric discriminants of some fieldless variants have changed; do not persist enum casts as stable identifiers.
- Group a complete macro invocation, including its count and nested calls, into one undo transaction. Hosts must honor `Transaction::Begin`, `Continue`, and `End` during macro playback as well as Insert/Replace sessions.

To upgrade, change the dependency to `vimlet = "0.2"`, add the new enum match arms, and verify that one undo reverses an entire counted or nested macro invocation. Ropey consumers should retain `features = ["ropey"]`.

### Added

- Dispatch recorded keys through host keymaps with bounded `MacroPlayback` and `MacroBinding` APIs.
- Preserve host-specific named keys in macros and repeat accepted host edits within Insert sessions.
- Expose an unnamed-register revision counter for clipboard synchronization, including repeated identical yanks.

### Fixed

- Stop macro playback when a vertical motion is blocked at a document boundary. ([#1](https://github.com/codersauce/vimlet/pull/1))
- Resolve rectangular edits and characterwise Visual repeat in display cells, including short lines, tabs, and wide characters.
- Match Neovim's Visual Enter and block-corner switching behavior.
- Respect empty-line and end-of-file boundaries in change operators, and improve host-dispatched repeat and Visual puts.

### Performance

- Keep character edits local on long string-backed lines.

[Full changelog](https://github.com/codersauce/vimlet/compare/v0.1.0...v0.2.0)

## [0.1.0](https://github.com/codersauce/vimlet/tree/v0.1.0) — 2026-10-26

### Added

- Initial standalone Vim editing engine with host-owned storage and undo, string and optional Ropey adapters, integration guides, and Neovim conformance checks.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vimlet"
version = "0.1.0"
version = "0.2.0"
edition = "2021"
rust-version = "1.90"
description = "A headless Vim editing engine for Rust"
Expand All @@ -11,7 +11,7 @@ homepage = "https://github.com/codersauce/vimlet"
documentation = "https://docs.rs/vimlet"
keywords = ["vim", "editor", "modal", "headless"]
categories = ["text-editors"]
include = ["src/**", "examples/**", "tests/**", "docs/**", "scripts/**", "assets/vimlet.png", "Cargo.toml", "Cargo.lock", "README.md", "LICENSE", "NOTICE"]
include = ["src/**", "examples/**", "tests/**", "docs/**", "scripts/**", "assets/vimlet.png", "Cargo.toml", "Cargo.lock", "README.md", "CHANGELOG.md", "LICENSE", "NOTICE"]

[package.metadata.docs.rs]
all-features = true
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

# Vimlet

[![Crates.io](https://img.shields.io/crates/v/vimlet.svg)](https://crates.io/crates/vimlet)
[![Documentation](https://docs.rs/vimlet/badge.svg)](https://docs.rs/vimlet)
[![CI](https://github.com/codersauce/vimlet/actions/workflows/release.yml/badge.svg?branch=main)](https://github.com/codersauce/vimlet/actions/workflows/release.yml)
[![License: MIT](https://img.shields.io/crates/l/vimlet.svg)](LICENSE)
[![Rust](https://img.shields.io/crates/msrv/vimlet.svg)](Cargo.toml)

Vimlet adds Vim editing to Rust applications. Extracted from the Red editor, it interprets keys, manages modes, registers and repeat, and returns operations for your application to apply. Your application keeps its text storage, undo history and UI.

Use a plain `String`, implement `TextSource` for your buffer, or enable the optional `ropey` adapter. Vimlet has no dependency on Red or an async runtime. Rust 1.90 or newer is required.
Expand All @@ -32,14 +38,14 @@ Add Vimlet to your application's `Cargo.toml`:

```toml
[dependencies]
vimlet = "0.1"
vimlet = "0.2"
```

For an application that already uses Ropey:

```toml
[dependencies]
vimlet = { version = "0.1", features = ["ropey"] }
vimlet = { version = "0.2", features = ["ropey"] }
ropey = "1.6.1"
```

Expand Down Expand Up @@ -93,3 +99,7 @@ python3 scripts/check_package.py
The [string host](examples/support/mod.rs) demonstrates undo grouping and macro dispatch. The [Ropey host](examples/support/rope.rs) converts byte ranges for rope mutation.

Neovim decides compatibility questions for implemented commands. The reference runner uses Neovim 0.12.1 and Python 3 to compare text, byte cursor, mode and the unnamed register. Vimlet implements modal editing; application services such as search UI, formatting and clipboard transport remain in the host. See the [scope and host contracts](docs/EXTRACTION_PLAN.md).

## Releases

See the [changelog](CHANGELOG.md) for changes and the [release guide](docs/RELEASING.md) for the publishing process.
65 changes: 65 additions & 0 deletions docs/RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Releasing Vimlet

Release-plz maintains a release PR with the next version and `CHANGELOG.md`.
Merging that PR publishes the crate, creates its `vX.Y.Z` tag, and creates a
GitHub Release using the same changelog entry.

## Prepare a release

1. Squash-merge changes with descriptive Conventional Commit titles:
`feat: ...`, `fix: ...`, `perf: ...`, or `docs: ...`. Use `!` or a
`BREAKING CHANGE:` footer for incompatible changes.
2. Review the release PR's version and changelog. Put migration instructions
under Breaking changes and describe user-visible behavior. The SemVer check
helps detect API breaks; it cannot detect every behavioral incompatibility.
3. Record Red and Codex qualification of the release's code revision in the PR,
as required by the extraction plan. Requalify if runtime code changes.
4. Wait for CI, then merge the release PR. Its branch must retain the
`release-plz-` prefix. Ordinary PR merges do not publish.
5. Check the Release workflow, the new crates.io version, the matching GitHub
tag/release, and the docs.rs build. Documentation can finish after publication.

For a manual version adjustment on the release branch, run
`release-plz set-version vimlet@0.2.0` (substitute the intended version), then
review the manifest, lockfile, and changelog before committing.

## Validation and retries

The Release workflow reuses CI on the exact main-branch commit before publishing:
Rust 1.90 tests, Clippy, formatting, warning-free rustdoc, Neovim 0.12.1
conformance, and packaged consumers. Rust checks cover both default features and
Ropey. Publishing retains Cargo's package verification.

The release PR uses GitHub's built-in token. Because bot-created PRs do not
trigger normal PR workflows, the workflow explicitly dispatches CI on the release
branch. No personal GitHub token or GitHub App is required.

On failure, inspect the failed job before retrying. Re-run the failed workflow
on its original commit; do not move release tags. Publishing to crates.io and
GitHub is not atomic. If the crate already exists, verify its source revision
before repairing a missing GitHub Release. A new workflow dispatch runs on the
selected branch's current head, which may no longer be the failed release commit.

## One-time setup

Allow GitHub Actions to create pull requests in the repository's Actions settings.
In the crate's crates.io settings, add a GitHub Trusted Publisher:

- Repository owner: `codersauce`
- Repository: `vimlet`
- Workflow filename: `release.yml`
- Environment: leave blank

Release-plz obtains a short-lived publishing token through GitHub OIDC. Do not
add a `CARGO_REGISTRY_TOKEN` secret to this workflow. A crate must already exist
on crates.io before Trusted Publishing can be configured.

## Changelog style

`release-plz.toml` defines the section order: Breaking changes, Added, Fixed,
Performance, Documentation, then Changed for older nonconventional commits.
Empty sections are omitted. Routine chore, CI, build, test, style, and refactor
commits are filtered; breaking changes remain visible. Scopes are omitted from
bullets, PR references are linked, and each release links to the full comparison.
Review generated prose before merging; automation cannot write migration guidance
or determine which implementation details matter to consumers.
33 changes: 33 additions & 0 deletions release-plz.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[workspace]
release_always = false
semver_check = true
dependencies_update = false
git_release_enable = true
publish_timeout = "10m"

[changelog]
header = "# Changelog\n\nNotable changes to Vimlet. Each release uses the same notes here and on GitHub.\n\n"
protect_breaking_commits = true
sort_commits = "oldest"
postprocessors = [{ pattern = "\n{3,}", replace = "\n\n" }]
commit_parsers = [
{ field = "breaking", pattern = "true", group = "0Breaking changes" },
{ message = "^feat", group = "1Added" },
{ message = "^fix", group = "2Fixed" },
{ message = "^perf", group = "3Performance" },
{ message = "^docs", group = "4Documentation" },
{ message = "^(chore|ci|build|test|style|refactor)(\\(|:)", skip = true },
{ message = "^Merge ", skip = true },
{ message = ".*", group = "5Changed" },
]
body = """
## [{{ version }}](https://github.com/codersauce/vimlet/releases/tag/v{{ version }}) — {{ timestamp | date(format="%Y-%m-%d") }}
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | trim_start_matches(pat="0") | trim_start_matches(pat="1") | trim_start_matches(pat="2") | trim_start_matches(pat="3") | trim_start_matches(pat="4") | trim_start_matches(pat="5") }}

{% for commit in commits -%}
- {{ commit.message | split(pat="\n") | first | upper_first }}{% if commit.links %} ({% for link in commit.links %}[{{ link.text }}]({{ link.href }}){% if not loop.last %}, {% endif %}{% endfor %}){% endif %}
{% endfor %}
{% endfor %}
{% if release_link %}[Full changelog]({{ release_link }}){% endif %}
"""
2 changes: 1 addition & 1 deletion src/guide/quickstart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! Add this under `[dependencies]` in the application's `Cargo.toml`:
//!
//! ```toml
//! vimlet = "0.1"
//! vimlet = "0.2"
//! ```
//!
//! The default feature set supports strings and custom text sources. No Ropey
Expand Down
Loading