deindent 1.0.1

A command line utility and Rust library to format overly-indented text.
Documentation
  • Coverage
  • 90.91%
    10 out of 11 items documented0 out of 7 items with examples
  • Size
  • Source code size: 13.1 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 356.25 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • adriangoransson/deindent
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • adriangoransson

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