From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 189 invoked by alias); 13 Apr 2012 17:45:56 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17003 Received: (qmail 27912 invoked from network); 13 Apr 2012 17:45:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.eastlink.ca designates 24.224.136.30 as permitted sender) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.0 cv=F9MshtdN c=1 sm=1 a=2frB+lQ33in3Y4iuP+4efw==:17 a=wfYgvVYxD2IA:10 a=8nJEP1OIZ-IA:10 a=baPiUPNdMCnkTqtANdUA:9 a=8Q5R4oQS6uEIo7frjNUA:7 a=wPNLvfGTeEIA:10 a=k1w2ZutsjhWYawe+LO1aOw==:117 Message-id: <4F885F3B.9000402@eastlink.ca> Date: Fri, 13 Apr 2012 10:15:39 -0700 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120312 Thunderbird/11.0 MIME-version: 1.0 To: zsh-users@zsh.org Subject: write a command line. Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit Gentlemen, Back to attempting suicide by zsh. Just kidding, I'm sure if I could live to be 200 by then this would all make perfect sense. It's awesome that you guys have some grasp of all this. Anyway, for now I'm trying to make a script that will create but *not* execute a command. That is to say it will write a string (which will be a command) to the command line but not press the ENTER key. Rather, when the script exits it will just leave the created string on the command line so that I can modify it as needed and *then* I will press the ENTER key at my pleasure. A guy at StackOverflow came up with this: function hello () { BUFFER=hellothere zle end-of-line } zle -N hello #bind to Alt+a: bindkey "\ea" hello ... Which does exactly what I want when I press 'Alt+a' , but I don't want to bind a key, I just want to 'do it', that is to leave "hellothere" on the command line after my script exits. I tried to fool around with the 'hello' function but I can't get it to run by itself from the command line. With 'autoload -U zle' in my .zshrc I get: zle: function definition file not found ... with my .zshrc unmodified I get: zle: widgets can only be called when ZLE is active Apart from that, the closest I've come so far is to have my script echo the command it generates to the history file just before quitting. I can then use the up arrow to retrieve it, modify it as required, and then execute it. If there was some way of performing an 'auto up arrow' that would do it I think. But I can't believe that zsh doesn't have some simple way of writing some string to the prompt line and just leaving it there. Regards,