Skip to content

Instantly share code, notes, and snippets.

@mpvosseller
Created November 26, 2021 13:27
Show Gist options
  • Save mpvosseller/a6327ec8e9870decd61e0c3e6f568402 to your computer and use it in GitHub Desktop.
Save mpvosseller/a6327ec8e9870decd61e0c3e6f568402 to your computer and use it in GitHub Desktop.
txt-preview - function to open text from stardard-input in Preview
## function to open text from stardard-input in Preview
## inspired by the `man-preview` function of Oh My Zsh that opens any man page in Preview https://github.com/ohmyzsh/ohmyzsh/blob/b60b3f184275c39800dd7284d6904fcf295b3956/plugins/macos/macos.plugin.zsh#L221
## requires enscript: `brew install enscript`
## example usage:
## echo "hello world" | txt-preview
function txt-preview() {
enscript -q -B -p- | open -f -a Preview
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment