From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14329 invoked by alias); 15 May 2016 10:49:48 -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: 21565 Received: (qmail 16321 invoked from network); 15 May 2016 10:49:44 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=sab+anH/wYfyVhUq6qQ6gleMBp/qjJPdpCD9s97VCm4=; b=kd3caetiE6PFLgkekKPNBqiVdLs9mj6vYSh9B57Uois8nMA/IJldPzTE1IHO7L2KMX nEJpWkumkbQJCaAD+3BGC04C1ODONVN3xCMDfAmPhXT015c08IQ/YwxBRn+EdTiw50VB vDaJOi7vfjF2uDD8TuzoVyB/wgoH/PqafEwDm2+ZNG/RTh5748yofxh427pRy3wa6DNt o2wgKItQmrFmEqz5Xsejtzognds1f3ghLhFDyy+f4YE7y6k79cutB0YP6bHEijHdlgle 6czCXs89DnW3au1zeh6fltkRZv3wduww13E9TUySXT3jVG4hjstt31Y+xXbTmTjmR7ew ulKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=sab+anH/wYfyVhUq6qQ6gleMBp/qjJPdpCD9s97VCm4=; b=IecJOn49sZOqQULt04Oe8Z4S8hHS0YGw/gpdoqRvs3nLbHNlEKJdX8RC8noFwG+1tH yojhmJXQdrAxq9sSfNXQ0KVwwz8zpsXZddBIZA1sAr27S4QHS8AZNxrl8nWbU+8aFHMC pEHDz0Dw3+lZNhJK/g1c6XSWpKVdTQ4ZnFCIzabM9NF0vLU23MbTWBYo3yiNSo9dSFwG sLfDraY4kn4qp3bxfhaCEvDpi7Viu1WOQMz3k224swccuTVNEzZHts8ROgzNfq3OAWs5 2yRCwnJAvzKbIrwYrIV23tkdbUhNpDulc/CKSDTxbAYI6YKfntleeI4miXkL6p537hDA O+wA== X-Gm-Message-State: AOPr4FXP4eJpefl0rrW0ikY08Vp0kxeEWDWs0H95PLU2Ew1eVjzzd8h/SYQ3trYPi8jv1jqXYVYejKevwuLiag== MIME-Version: 1.0 X-Received: by 10.112.72.193 with SMTP id f1mr9873163lbv.114.1463309380604; Sun, 15 May 2016 03:49:40 -0700 (PDT) In-Reply-To: References: <160511142150.ZM9063@torch.brasslantern.com> Date: Sun, 15 May 2016 03:49:40 -0700 Message-ID: Subject: Re: Rotate shell words widget From: Bart Schaefer To: Sebastian Gniazdowski Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 On Sat, May 14, 2016 at 2:30 PM, Sebastian Gniazdowski wrote: > On 13 May 2016 at 11:23, Bart Schaefer wrote: >> Also it looks like this always rotates all the words in the buffer, so >> e.g. the last word moves to command position no matter what word the >> cursor is on. If the reason is to be able to edit a different word, >> wouldn't it make more sense to move the word at the end to the cursor >> (or the word at the cursor to the end)? > > I'm not fully following this, maybe an example? Seems sophisticated, though. Suppose I have: % echo one two three four and the cursor is on the "w". With your widget as-is, rotating "forward" gives % four echo one two three with the cursor on the space between "one" and "two". I don't understand why someone would ever want to do that. It doesn't make sense for "four" to become the command word, and the final cursor placement isn't helpful. (Also the choice of calling this "forward" rotation is a bit arbitrary, because the most obvious change is that "four" moved *backward*, it's the rest of the line that went forward; but you can define it either way.) If instead rotate forward produced % echo one four two three with the cursor either still on the "w" or somewhere in the word "four", that might have some utility. (This is what I meant by "acts on $RBUFFER"). Similarly I'd expect rotate backward to do one of % echo one three four two OR ("acts on $LBUFFER") % two echo one three four though again I don't know why you'd shift a different word into command position. Maybe "rotate-arguments" would be a better widget, something that would produce % echo four one two three i.e. without moving the "echo". And in that case ESC 2 ESC r would produce % echo three four one two Cursor placement still needs some thought.