Assuming Sublime still doesn’t support opening STDIN, a straightforward solution is to dump the output to a temporary file, open the file in sublime, and then delete the file. Say you create a script called tosubl in your bin directory as follows:
#!/bin/bash
TMPDIR=${TMPDIR:-/tmp} # default to /tmp if TMPDIR isn't set
F=$(mktemp $TMPDIR/tosubl-XXXXXXXX)
cat >| $F # use >| instead of > if you set noclobber in bash
subl $F
sleep .3 # give subl a little time to open the file
rm -f $F # file will be deleted as soon as subl closes it
Then you could use it by doing something like this:
$ ps | tosubl
But a more efficient and reliable solution would be to use to use Process Substitution if your shell supports it (it probably does). This does away with the temporary files. Here it is with bash:
tosubl() {
subl <(cat)
}
echo "foo" | tosubl
I’m pretty sure you can somehow remove the use of cat in that function where it’s redundantly shoveling bits from stdin to stdout, but the syntax to do so in that context eludes me at the moment.