Skip to content

Latest commit

 

History

History
202 lines (128 loc) · 6.89 KB

File metadata and controls

202 lines (128 loc) · 6.89 KB

Getting Started

ane is a chord-based terminal code editor built for humans and code agents. Every edit is expressed as a four-part chord -- action, positional, scope, component -- that composes into precise, language-aware operations. An embedded language server gives chords access to functions, variables, structs, and other symbols out of the box.

This guide walks you through the core concepts and gets you making edits.


Core concepts

Chords

A chord is a four-part instruction that describes an edit:

<action><positional><scope><component>

For example, cifc means Change Inside Function Contents -- replace the body of a function. Chords can also be written in long form: ChangeInsideFunctionContents.

Arguments are passed in parentheses:

cifc(target:foo, value:"return 0;")

The positional can also be a digit 19 for count-based operations (e.g. j5lw -- jump forward 5 words).

See Chord System for the full reference and Chord Examples for worked before/after examples of every valid combination.

Two frontends

ane has two ways to run:

  • TUI -- an interactive terminal editor with a file tree, syntax highlighting, and a chord input box. Designed for humans.
  • Exec -- a headless one-shot mode that applies a chord and outputs a unified diff. Designed for code agents and scripts.

Both frontends use the same chord engine. Some chords are frontend-specific: Jump is TUI-only (the CLI has no cursor).

Language server integration

Chords that target language constructs (Function, Variable, Struct, Member) use an embedded language server to resolve symbols. ane auto-detects your project language, starts the server in the background, and installs it if needed.

Line, Buffer, and Delimiter scopes work immediately without LSP.

Supported: Rust (rust-analyzer), Go (gopls), TypeScript/JavaScript (vtsls), Python (basedpyright). All include tree-sitter syntax highlighting. Markdown has tree-sitter highlighting with no LSP server.


Installation

curl -s https://prettysmart.dev/install/ane.sh | sh

The installer detects your platform and puts ane on your PATH.

Other installation options

With cargo:

cargo install ane-editor

With mise -- using the GitHub backend:

mise use -g github:prettysmartdev/ane

To pin to a specific version: mise use -g github:prettysmartdev/ane@0.2.0

From GitHub Releases -- download the binary for your platform from GitHub Releases:

Platform Asset
Linux (x86_64) ane-linux-amd64
Linux (ARM64) ane-linux-arm64
macOS (Intel) ane-macos-amd64
macOS (Apple Silicon) ane-macos-arm64

From source -- requires Rust 1.75+ and make:

git clone https://github.com/prettysmartdev/ane.git
cd ane
sudo make install

Your first TUI session

Open a file or directory:

ane .                   # directory -- opens file tree + editor
ane path/to/file.rs     # single file -- opens directly in editor

ane starts in Chord mode. A command box appears at the bottom of the screen. Type a chord and press Enter to execute it. Short-form chords (4 lowercase characters) auto-execute when the combination is valid for the current cursor position.

Press Ctrl-E to switch to Edit mode for direct text editing. Press Esc or Ctrl-E to return to Chord mode.

Key reference:

Key Action
Ctrl-E Toggle Edit / Chord mode
Ctrl-T Toggle file tree
Ctrl-S Save file
Ctrl-C Exit (confirmation modal)
Ctrl-O Reload file from disk (when external change detected)
Arrow keys Navigate cursor

When the file tree is focused, Ctrl-R renames, Ctrl-D deletes, and Ctrl-N creates a new file. The tree live-updates when files change on disk.

See Using the TUI for the full keybinding reference and mode details.


Your first CLI edit

Exec mode applies a single chord to a file and outputs a unified diff:

# Discover what's in a file
ane exec --chord "lefd" path/to/file.rs

# Read one function body (prefer over reading the whole file)
ane exec --chord "yefc(target:init)" src/main.rs

# Change line 5 to new text
ane exec --chord "cels(target:5, value:\"new text\")" path/to/file.rs

# Delete line 3
ane exec --chord "dels(target:3)" path/to/file.rs

# Replace a function body
ane exec --chord "cifc(target:init, value:\"    todo!()\")" src/main.rs

# Insert a new line after line 10
ane exec --chord "aals(target:10, value:\"    let x = 1;\")" path/to/file.rs

# Append inline at the end of line 10
ane exec --chord "aels(target:10, value:\" // TODO\")" path/to/file.rs

Exec mode writes a unified diff to stdout. Yank chords output the selected text instead. Use the narrowest scope possible -- yefc/cifc for one function is far more efficient than yebs/cebs for the whole file.

See Exec Mode for stdin piping, agent integration patterns, and more.


Embedding ane as a library

If you're building a code agent or custom tooling, you can use ane as a Rust crate without the CLI/TUI dependencies:

[dependencies]
ane-editor = { version = "0.2", default-features = false }

This gives you the chord engine, LSP engine, buffer management, and a tool definition for LLM integration -- without pulling in clap, crossterm, or ratatui.

See Embedding via Crate for the full API surface and usage examples.


Teaching ane to your code agent (optional)

ane can optionally generate a token-efficient skill file that teaches a code agent the chord grammar:

ane init claude      # creates .claude/skills/ane/SKILL.md
ane init codex       # creates .codex/skills/ane/SKILL.md

Supported agents: claude, codex, gemini, opencode, cline, maki, charm.

The skill file is optional — agents can use ane exec directly — but it helps them pick the right chords without trial and error.


What's next


Next: Chord System ->