fn paste() {
let text = clipboard.read();
let clean = dedent(text);
clipboard.write(clean);
}
Paste clean. Stay in flow.
dedent-paste removes the common indentation from your clipboard, rewrites the result as plain text, and pastes it immediately. Use Left Option+V with Karabiner-Elements on macOS, or Win+V with AutoHotkey on Windows.
brew tap doggy8088/dedent-paste && brew trust doggy8088/dedent-paste && brew install dedent-paste && dedent-paste --install
curl -fsSL https://raw.githubusercontent.com/doggy8088/dedent-paste/main/install.sh | bash
irm https://github.com/doggy8088/dedent-paste/releases/latest/download/dedent-paste-installer.ps1 | iex
Homebrew installs the binary only; dedent-paste --install adds the Left Option+V rule to
Karabiner-Elements. The shell installer does both in one go. Also on
npm as npm install -g dedent-paste.
On Windows, install AutoHotkey v2 or
v1.1 (Unicode), then run dedent-paste --install
to enable Win+V now and at login. If PATH has not refreshed after the PowerShell installer, run
& "$HOME\.local\bin\dedent-paste.exe" --install in PowerShell.
fn paste() {
let text = clipboard.read();
let clean = dedent(text);
clipboard.write(clean);
}
Homebrew on macOS, three commands.
The doggy8088/dedent-paste tap is updated automatically by every release. Homebrew 6 and later ask you to trust a third-party tap once before installing from it; older versions can skip that step.
brew tap doggy8088/dedent-paste, then brew trust doggy8088/dedent-paste, then
brew install dedent-paste. The binary lands in Homebrew's bin; nothing else on
your system is touched yet.
Install Karabiner-Elements if you have not already
(brew install --cask karabiner-elements), then run dedent-paste --install. It
backs up karabiner.json, adds a Left Option+V rule pointing at the Homebrew binary, and
replaces any older dedent-paste rule it finds. The right Option stays free for other tools. Allow Karabiner-Elements under Privacy & Security > Accessibility.
brew upgrade dedent-paste keeps the hotkey working because the rule points at a
version-independent path. To remove: dedent-paste --uninstall takes the rule out of every
Karabiner profile, then brew uninstall dedent-paste.
Two platforms, clear setup paths.
Pick the stack that matches your machine. The README separates macOS and Windows install, setup, and usage steps so you can wire up the right shortcut without guessing.
Install with Homebrew or the shell installer, run dedent-paste --install to add the Karabiner rule (the shell installer does this for you), and allow Accessibility access if macOS asks.
Run the PowerShell installer and install AutoHotkey v2 or v1.1 (Unicode), then run dedent-paste --install. It prefers v2, creates a dedicated script, and enables Win+V immediately and at login for the current user. No administrator rights are needed. AutoHotkey must be installed separately.
Win+V replaces Windows clipboard history. Stop any older Win+V scripts yourself to avoid conflicts. For a different shortcut, use the manual AutoHotkey setup.
The managed script uses this executable's full path. Rerun dedent-paste --install after moving dedent-paste or AutoHotkey. Existing managed scripts are backed up before changes; unrelated scripts and startup shortcuts are left alone.
dedent-paste --uninstall stops and backs up the managed script, then removes it and its login shortcut. Your backups, other scripts, and both installed programs are kept.
A tiny tool for oversized paste moments.
Fast, precise, and made for people who move text all day. One shortcut removes the messy shared indent while leaving your normal paste shortcut untouched on each platform.
dedent-paste --install sets up Left Option+V through Karabiner-Elements on macOS, leaving the right Option for other tools, or Win+V through AutoHotkey on Windows. Use manual AutoHotkey setup for a different shortcut.
Every release updates the Homebrew tap and the npm package, and publishes shell and PowerShell installers, platform archives, and checksums.
The clipboard is read as text, written back as UTF-8, then pasted with macOS System Events or a simulated Ctrl+V on Windows. On macOS the paste waits until you release the modifier keys, and only one instance runs at a time. Prefer your own hotkey manager (skhd, Hammerspoon)? Run dedent-paste --no-paste and send Cmd+V yourself.
Copy an image. Paste the text.
Optional: when the clipboard holds an image instead of text, dedent-paste can send it to the Gemini API, transcribe it into Markdown-formatted text (or describe it, in Traditional Chinese by default), and paste the result. Without an API key the feature stays completely silent.
Get a key from Google AI Studio and expose it as GEMINI_API_KEY (or the tool-specific
DEDENT_PASTE_GEMINI_API_KEY). Pick the output language with DEDENT_PASTE_LANG,
e.g. zh-TW. Exporting in your terminal is not enough — the hotkey tool must see the variables.
Karabiner never loads your shell profile. Put export GEMINI_API_KEY=... in
~/.config/dedent-paste/env (then chmod 600 it). The rule written by
dedent-paste --install already sources that file before running, so no manual edit of
karabiner.json is needed.
AutoHotkey inherits user environment variables: run setx GEMINI_API_KEY "your-key", then
start a fresh terminal session and rerun dedent-paste --install to restart the managed script
with the new variables. For manual scripts, restart them from the fresh session or call EnvSet
before RunWait. Reinstalling backs up and replaces edits to the managed script.
Full details in the README.