Skip to content

Instantly share code, notes, and snippets.

@echosa
Created July 10, 2014 14:25
Show Gist options
  • Save echosa/a5fd4b6637718c455e43 to your computer and use it in GitHub Desktop.
Save echosa/a5fd4b6637718c455e43 to your computer and use it in GitHub Desktop.
Delete trailing spaces in Acme
#!/usr/bin/env bash
# Removes trailing spaces from entire window.
# Run as `trail` (no | or < necessary)
# Inspired by:
# http://www.mostlymaths.net/2013/03/extensibility-programming-acme-text-editor.html
echo -n "0,$" | 9p write acme/$winid/addr
9p read acme/$winid/body | sed 's/ *$//g' | 9p write acme/$winid/data
echo -n "0,0" | 9p write acme/$winid/addr
echo -n "dot=addr" | 9p write acme/$winid/ctl
echo -n "show" | 9p write acme/$winid/ctl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment