Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
pre-populate zle for next command?
- X-seq: zsh-users 22858
- From: Stephen Talley <stephentalley@xxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: pre-populate zle for next command?
- Date: Thu, 31 Aug 2017 13:38:02 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=ZNtyub15MKhSPeQkP6H9nBSBTOaOhoYEu7pudWdzVL0=; b=ZzUh/dbjgb8I63rMCB3ACV9kFSsuy6vBNmP0PtmfRHNyqBq6nNTCPUqwbPhRV4baQB ONUw7jkm+a7Zw36tgy0+Zz5D4ICX/avFN/6R25pXYSYw0T+Ud7ZW8BOGU2GoLzmlij43 4Iw6Hdkz8Nhcbf8u3CZTOeANA6NMYnvhhPIUauN8a8erG6nOLzGq7Yajz/Kp9P7LujeV zlns68ZIwj1ONCTMZevTMdEOMydpZs6FzWCAeGEk0ovfmXtUbh09JY4AxtqgDxwChFMD +1yKdcVFEQOlhMUaj4kmh33URkKahag+IsBbagcb55UnXa9i45YqYPtWfsyXZsSg/Z7x 7+1w==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Sender: stephentalley@xxxxxxxxx
Is there any way for a command to pre-populate the the zle for the next
command?
Suppose I have, for example, a zsh function "buildcmd" that produces a
command line (based on supplied arguments, say) that the user would then be
able to edit in the zle before hitting enter to accept the line and execute
it. The flow would be:
% buildcmd --my --args<enter>
% <output_from_buildcmd>
I know I could just do:
% `buildcmd --my --args`<tab>
to achieve the same thing, but it's a bit more tedious than I'd like.
Ideally there'd be some hook (precmd? accept-line?) that could check a
variable and pre-populate the zle:
buildcmd() {
zle_prepopulate="some command to edit"
}
precmd() {
if [ -n "$zle_prepopulate" ]
then
zle -U "$zle_prepopulate"
fi
}
...but of course this doesn't quite work because the call to zle is not in
the context of a widget.
Is there a way?
Thanks!
Steve
Messages sorted by:
Reverse Date,
Date,
Thread,
Author