micro icon indicating copy to clipboard operation
micro copied to clipboard

Print to `stdout`

Open ParadaCarleton opened this issue 4 months ago • 4 comments

Request: some way to print the current buffer to stdout, so I can insert micro into a pipe (x | micro | y) and edit the input before I pass it to y.

ParadaCarleton avatar Oct 14 '25 03:10 ParadaCarleton

This is not a feature for the text editor itself, you should use an external tool like vipe from moreutils which allows you to pipe text through any editor.

Andriamanitra avatar Oct 14 '25 09:10 Andriamanitra

This is not a feature for the text editor itself, you should use an external tool like vipe from moreutils which allows you to pipe text through any editor.

That definitely looks interesting, but unfortunately I can't set vipe to be my default $EDITOR.

ParadaCarleton avatar Oct 17 '25 16:10 ParadaCarleton

That definitely looks interesting, but unfortunately I can't set vipe to be my default $EDITOR.

You're not supposed to set vipe as your editor, vipe looks up the value of $EDITOR environment variable to pick the editor to use. So you would use it like this:

$ command1 | EDITOR=micro vipe | command2
# or, if you already have $EDITOR set to micro in your shell configuration files:
$ command1 | vipe | command2

Andriamanitra avatar Oct 17 '25 18:10 Andriamanitra

You're not supposed to set vipe as your editor, vipe looks up the value of $EDITOR environment variable to pick the editor to use.

Sorry, to clarify, what I meant is that my use case involves another shell script (written by someone else) piping something to my $EDITOR, and then I want to use the output of that script in something else. In that scenario, I don't have the ability to call vipe myself.

ParadaCarleton avatar Oct 17 '25 18:10 ParadaCarleton