From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18369 invoked by alias); 16 Nov 2010 21:28:44 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28417 Received: (qmail 17096 invoked from network); 16 Nov 2010 21:28:42 -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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 _spf.google.com designates 209.85.215.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:reply-to:to:subject:date :user-agent:references:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; bh=pHaYPH2n00yOiNXOZnxR7ZC6XCzs3eIMaetYLys5ASw=; b=ONStSngZ2wu83UqNLpd3iBCJtM2N+H+LcXnA6sUV3/3zHoYD0HwxRBJhnpE3DFcEIQ bUuoMbI2qLRcL82jm2L/NRZTj5d6fiEBKC9bmP/SAXrFR6VrwcKPRK7pFp82UC4wrzlI lCDO4ob8JMCd65egrjxjQ+hMXgNQKUrYFsJrw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:reply-to:to:subject:date:user-agent:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; b=cArglIGHArF6YNhqOOW8wYWsrNwcKYzQLH95mvLAAfQWxLWJ9S42xCn3gPYOB3Dg6w Mns4rZw08vTH1uBzozLzC6AMZchugIeYPcn7dzev8haeicCNeHpJFJ8xBH5M6NkphfaF rZwBNsYcr/qdyIWl+9l6Yx9jQpQPsv+TQsVrM= From: ZyX Reply-To: zyx.vim@gmail.com To: zsh-workers@zsh.org Subject: Re: CTRL-O in vi mode Date: Wed, 17 Nov 2010 00:04:23 +0300 User-Agent: KMail/1.13.5 (Linux/2.6.34-zen1; KDE/4.4.5; x86_64; ; ) References: <4CE2EA45.6060909@gmx.de> In-Reply-To: <4CE2EA45.6060909@gmx.de> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2230845.FC0DvoZZrA"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201011170004.23709@-zyx> --nextPart2230845.FC0DvoZZrA Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Reply to message =ABCTRL-O in vi mode=BB,=20 sent 23:32:05 16 November 2010, Tuesday by Bernd Strohhaecker: > I'm using vi mode. Is it possible in viins mode to realize Vim's CTRL-O > command, e.g. execute one vicmd command and then return to viins mode? Of course, it is. I do use emacs mode but have lots of custom mappings and = is one of them: function _-vi-digit-arg { emulate -LR zsh [[ -z "${NUMERIC}" ]] && NUMERIC=3D0 [[ -z "$1" ]] && num=3D0 || num=3D$(( $1 )) shift (( NUMERIC=3DNUMERIC*10+num )) && $@ } function _-repeat-for-key { emulate -LR zsh local key read -k key local -i OLDLLEN=3D${#LBUFFER} OLDRLEN=3D${#RBUFFER} local OLDLBUFFER=3D"$LBUFFER" OLDRBUFFER=3D"$RBUFFER" (( NUMERIC )) || NUMERIC=3D1 if ! [[ -z $2 ]] ; then eval $2 (( NUMERIC-- )) fi while (( NUMERIC )) ; do eval $1 (( NUMERIC-- )) done local -i LLEN=3D${#LBUFFER} RLEN=3D${#RBUFFER} if (( LLEN=3D##0 && key<=3D##9 )) then _-vi-digit-arg $(( key - ##0 )) _-vi-del= ete fi } function _-vi-ctrl-o { emulate -LR zsh local keystr read -k keystr local -r keystr local -ri key=3D$(( #keystr )) if (( key=3D=3D##A )) ; then zle end-of-line elif (( key=3D=3D##$ )) ; then zle end-of-line elif (( key=3D=3D##I )) ; then zle vi-first-non-blank elif (( key=3D=3D##d )) ; then _-vi-delete elif (( key=3D=3D##0 )) && [[ -z $NUMERIC ]] ; then zle beginning-of-line elif (( key>=3D##0 && key<=3D##9 )) then _-vi-digit-arg $(( key - ##0 )) _-vi-ctr= l-o #elif (( key=3D=3D##s )) ; then zle sedsubstitute #elif (( key=3D=3D##=3D )) ; then zle tailfor else zle ${${(z)$(bindkey -M vicmd $keystr)}[2]} fi } zle -N vi-ctrl-o _-vi-ctrl-o bindkey -N evi emacs bindkey -A evi main bindkey -rM evi "\C-o" bindkey -M evi "\C-o" "vi-ctrl-o" --nextPart2230845.FC0DvoZZrA Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) iEYEABECAAYFAkzi8dcACgkQkOgHluiXxU8TBACfVJRm4adpB08gW5SITNlDXZ48 pxgAnAm9Zo7IaNGGUH+0JzEHvn97LmhV =TRkp -----END PGP SIGNATURE----- --nextPart2230845.FC0DvoZZrA--