zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Rotate shell words widget
Date: Sun, 15 May 2016 03:49:40 -0700	[thread overview]
Message-ID: <CAH+w=7aX8z_iY=ExJt8YkPM9Fia7y5Eq1vYAno8Fzdqh4mdjTw@mail.gmail.com> (raw)
In-Reply-To: <CAKc7PVDJ6pSnqJ-four4mPgWm+PoAPzA==y1DxT9R6Luw0=rqw@mail.gmail.com>

On Sat, May 14, 2016 at 2:30 PM, Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
> On 13 May 2016 at 11:23, Bart Schaefer <schaefer@brasslantern.com> 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.


      parent reply	other threads:[~2016-05-15 10:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11  8:39 Sebastian Gniazdowski
2016-05-11 21:21 ` Bart Schaefer
2016-05-12  7:07   ` Sebastian Gniazdowski
2016-05-13  9:23     ` Bart Schaefer
2016-05-14 21:30       ` Sebastian Gniazdowski
2016-05-14 22:41         ` René Wilhelm
2016-05-15 10:49         ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7aX8z_iY=ExJt8YkPM9Fia7y5Eq1vYAno8Fzdqh4mdjTw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=sgniazdowski@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).