Skip to content
shx-dowPublic

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

etch.nvim

AI-powered code editing for Neovim, powered by Pi.

How it works

  1. Select code in visual mode (V then jj)
  2. Press <leader>ea
  3. A small input box appears right below the cursor — type what you want done
  4. The selection highlights and a spinner animates at the end of the line
  5. Pi processes the request → replacement is applied inline
  6. The spinner turns into ✓ done and fades away
  7. No buffer content is modified except the edit itself

Requirements

  • Neovim 0.9+
  • Pi CLI installed globally: npm install -g @earendil-works/pi-coding-agent
  • An API key for an LLM provider configured for Pi

Installation

lazy.nvim

{
  "your-username/etch.nvim",
  config = function()
    require("etch").setup({
      keybind = "<leader>ea",
      model = "opencode/deepseek-v4-flash-free",  -- or nil for Pi default
    })
  end,
}

packer

use({
  "your-username/etch.nvim",
  config = function()
    require("etch").setup()
  end,
})

Configuration

require("etch").setup({
  -- Visual mode keybinding
  keybind = "<leader>ea",

  -- Pi model to use
  -- e.g. "opencode/deepseek-v4-flash-free", "anthropic/claude-sonnet-4-20250514"
  -- nil = use Pi's default model
  model = nil,
})

Architecture

Visual select code → press <leader>ea
         │
         ▼
Inline input box (1 line, right below cursor)
         │
User types instruction → Enter
         │
         ▼
Selection highlighted + spinner animates at end of line
         │
         ▼
Lua writes prompt to temp file (full context + selection + instruction)
         │
         ▼
pi -p --model <model> < prompt.txt
         │
         ▼
Spinner → ✓ done → edit applied → marker fades

Project Structure

etch.nvim/
├── lua/etch/
│   ├── init.lua    # Entry point, keybinds, visual selection
│   ├── ui.lua      # Inline input box near cursor
│   └── runner.lua  # Spawns pi -p, spinner UI, parses result
└── README.md

Why pi -p instead of the Pi SDK?

SDK pi -p
Startup ~2-5s (imports + session init) ~0.01s
Deps 140+ npm packages None (pi is global)
Complexity Events, tools, sessions stdin → stdout
Our use case Overkill Perfect fit

For a single-turn "edit this selection" task, pi -p is dramatically simpler and faster.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages