Skip to content

Accept stdin in .insert-string widget? #291

Answered by akinomyoga
mozirilla213 asked this question in Q&A
Discussion options

You must be logged in to vote

In commit 2a524f3, I have implemented ble append-line <string>, which appends a line to the next command line.

This is an example:

$ ble append-line 'echo hello'[RET]
$ echo hello

This command can be used in subshells (which doesn't seem to be possible with Zsh's print -z). This command can be called multiple times to insert multiple lines.

$ (ble append-line 'echo hello');(ble append-line 'echo world')[RET]
$ echo hello
echo world

Of course, this can be used to insert the commands read from a pipe:

$ { echo echo hello; echo echo world; } | ble append-line "$(cat)"
$ echo hello
echo world

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@akinomyoga
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by mozirilla213
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
NYI/NewFeat Not yet implemented or New Feature
2 participants