From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10256 invoked by alias); 2 Aug 2011 14:54:32 -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: 16186 Received: (qmail 6242 invoked from network); 2 Aug 2011 14:54:31 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at gmx.net designates 213.165.64.23 as permitted sender) X-Authenticated: #28939725 X-Provags-ID: V01U2FsdGVkX1+5okVbHuq5Qn2Tr16bj5ScFh+2S8akO+RqHRZLXW 5qtJY6ed8t5eIa Message-ID: <4E380FF2.3020309@gmx.net> Date: Tue, 02 Aug 2011 16:55:46 +0200 From: Pascal Wittmann User-Agent: Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20110628 Thunderbird/5.0 MIME-Version: 1.0 To: zsh-users@zsh.org Subject: Re: zle insert problems References: <4E380791.2090807@gmx.net> In-Reply-To: X-Enigmail-Version: 1.2 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigF184967A17023DF1163D5CE2" X-Y-GMX-Trusted: 0 --------------enigF184967A17023DF1163D5CE2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 08/02/2011 04:34 PM, Mikael Magnusson wrote: > On 2 August 2011 16:20, Pascal Wittmann wrote:= >> Hi, >> >> I'm trying to build something like this: >> >> function do-something() { >> zle beginning-of-line >> zle -U "something" >> zle end-of-line >> } >> zle -N do-something >> bindkey "^[i]" do-something >=20 > You can modify the buffer directly via the BUFFER variable, so you > could just say BUFFER=3D"something $BUFFER" and it should do what you > want. buffer. >=20 Ok, that would work in this simple example. But actually I want to do some more stuff (the code above was just a minimal working example), here is the function: 9 replace-pacman-command() { 10 if [[ $LBUFFER =3D "pacman"* ]]; then 11 zle beginning-of-line 12 zle forward-word 13 zle delete-word 14 zle -U -- $@ 15 zle end-of-line 16 fi 17 } 18 19 replace-pacman-command-insert() { 20 replace-pacman-command "-S" 21 } 22 23 zle -N replace-pacman-command-insert 24 bindkey "^[i" replace-pacman-command-insert I think doing this directly via BUFFER gets quickly unreadable. --------------enigF184967A17023DF1163D5CE2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEAREKAAYFAk44D/QACgkQyJms5+IyKFJfAwCfa2k9Y0QWdYToBkI5DHxxDvAe b08An2y3LF0GIEQVl6/KLYOMCU5MXKQD =Jjf8 -----END PGP SIGNATURE----- --------------enigF184967A17023DF1163D5CE2--