Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: trouble with vimbindings...
- X-seq: zsh-users 13934
- From: iamjay <tyberion@xxxxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: trouble with vimbindings...
- Date: Mon, 16 Mar 2009 01:04:47 +0100
- Cc: zsh-users@xxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:received:date:from:to:cc :subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:x-editor:user-agent; bh=hc5waA18qnvIbAmqRTBUWfMm4G10E0pdb7cSlvn47tk=; b=rZs1LvhS6xNmJsQRMqHOFel6uvG+IYYfXcpY8EYtWp8LnH4HHKXre7ylw3ozXQG6E3 3bO0+cWhfZaAz02uL+elYfU/MoYrnv3OX8pckAnghLmMTW1oGUtgk+H0u8m2ZBpwb6AZ 0omr6CgEfyEeFkIpUD9a9I2wlKixVmFaWjHz8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:x-editor:user-agent; b=VUjyNSWOyyPvhhsiPFMFAs1MZICvf+0D/4LTyX0D9AsJ/MphR/dV5JPZoFz0YFP4HH ZDLBPjTredpw6RVayGjOQGLEBCINNY03aE/5RKet234i/y5cPsRk4Qac0OgUU5MyAeok KccLmMoq+nLkNhcHEypqXu0IKzpugTpLOEUSA=
- In-reply-to: <090315150137.ZM5453@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20090315205630.GA9446@xxxxxxxxxxxxxxxxxxxxxxxxx> <090315150137.ZM5453@xxxxxxxxxxxxxxxxxxxxxx>
Thanks!
That solves my problem...
Just wondering why it isn't implemented that way by default...
well nevermind
Best regards,
On Sun, Mar 15, 2009 at 03:01:37PM -0700, Bart Schaefer wrote:
> On Mar 15, 9:56pm, iamjay wrote:
> }
> } When using vimkeybindings with bindkey -v... and you create a laaaarge
> } command like:
> }
> } echo foo barfoo barfoo barfoo barfoo barfoo barfoo barfoo bar \
> } foo bar bar barba rbar b barb bar
> }
> } and you leave vim's insert mode.. theres no way for me to go to the
> } upper line..
>
> This is the way the line editor always works. When you hit enter
> at the end of the First line, the editor finishes and passes the
> line to the parser, which finds the backslash and starts up a new
> editor for the second line. (This is true in emacs mode as well.)
>
> So leaving insert mode while editing the second line leaves you in
> the same instance of the editor which "contains" only that second
> line.
>
> There are several ways to "fix" this. One would be to override the
> accept-line widget so that you never leave the first editor:
>
> backslash-accept-line() {
> # Consider replacing LBUFFER with BUFFER on the next two
> # lines, depending on your preferred semantics
> if [[ $LBUFFER = *\\ ]]
> then LBUFFER+=$'\n'
> else zle .accept-line "$@"
> fi
> }
> zle -N accept-line backslash-accept-line
>
> The above doesn't handle the general case of multi-line constructs.
> For that you need something more violent:
>
> init-cmd-mode() {
> # Needs adjustment if you otherwise define zle-line-init
> zle -D zle-line-init
> zle .vi-cmd-mode
> zle -R
> }
> vi-cmd-mode() {
> if [[ -n "$PREBUFFER" ]]
> then
> # Needs adjustment if you otherwise define zle-line-init
> zle -N zle-line-init init-cmd-mode
> zle push-line-or-edit
> else
> zle .vi-cmd-mode "$@"
> fi
> }
> zle -N vi-cmd-mode
>
> Using push-line-or-edit effectively says "kill this editor and start
> a new one with the entire multi-line command I was working on." The
> init-cmd-mode trick is needed to propagate the last command from the
> editor that's being killed, into the new editor that's starting up.
>
> Other solutions are also possible, but I'm not going to try to invent
> all of them ...
Messages sorted by:
Reverse Date,
Date,
Thread,
Author