deindent

Crates.iodeindent
lib.rsdeindent
version1.0.1
created_at2025-03-19 21:22:07.485731+00
updated_at2025-03-22 23:56:58.604479+00
descriptionA command line utility and Rust library to format overly-indented text.
homepage
repositoryhttps://github.com/adriangoransson/deindent
max_upload_size
id1598614
size13,102
Adrian Göransson (adriangoransson)

documentation

README

deindent

A command line utility and Rust library to format overly-indented text.

Installation

At the moment, a Rust (or more specifically Cargo) installation is needed. To install, run:

$ cargo install deindent

Example uses

My primary use-case for this utility is to deindent text that I'm copying from an editor to e.g. my browser.

Deindent system clipboard

Set up an alias in your shell that deindents your clipboard content.

  • macOS:
$ alias pbdeindent='pbpaste | deindent | pbcopy'
$ alias wl-deindent='wl-paste | deindent | wl-copy'

(Neo)Vim

The following Vimscript configures (Neo)Vim to automatically deindent the * (clipboard) register after yanking to it.

if executable("deindent")
    augroup DeindentClipboardRegister
        autocmd!
        autocmd TextYankPost *
            \ if v:event["regname"] == "*" |
            \ call setreg("*", system("deindent", getreg("*"))) |
            \ endif
    augroup END
endif
Commit count: 7

cargo fmt