zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: "zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: Re: emulate bash key bindings
Date: Fri, 10 Jan 2020 10:58:10 +0000	[thread overview]
Message-ID: <1578653890.5278.5.camel@samsung.com> (raw)
In-Reply-To: <1578649908.5278.2.camel@samsung.com>

On Fri, 2020-01-10 at 09:51 +0000, Peter Stephenson wrote:
> On Fri, 2020-01-10 at 03:46 +0300, Andrey Butirsky wrote:
> > 
> > On 09.01.2020 17:29, Peter Stephenson wrote:
> > > 
> > > 
> > > On Thu, 2020-01-09 at 17:18 +0300, Andrey Butirsky wrote:
> > > > 
> > > > 
> > > > On 08.01.2020 13:00, Peter Stephenson wrote:
> > > > > 
> > > > > 
> > > > > zstyle ':zle:backward-kill-space-word:*' word-style space
> > > > Is the asterisk here '...:*' needed for something?
> > > Safety.  Contexts get added to with more specific information.
> > > Some examples are given later in the zshcontrib manual.  Even
> > > if you never use them, this will still work.
> > Is it me who intended to add to that context for my widgets, or it can 
> > be changed implicitly somehow?
>
> The point is there are contributed widgets that test with a context
> ":zle:name-of-widget:some-other-stuff".  I haven't looked to see
> if you're likely to encounter them in what you're doing, but it's
> easy to be sure you're not going to fall foul of that.

I just looked at the code...

Actually, I'm wrong and in generally you *don't* want that stuff.

I need it in my case because I'm using the ridiculously over the top
word-context style (which I suspect no one else has ever used).  *This*
gives you a subcontext.  Otherwise, you *don't* get an extra
subcomponent, so you need to leave out the ":*".  There is documentation
on word-context indicating this extra behaviour, but it isn't relevant
in your case, so I've just been confusing you, sorry.

Here's an example of the re-using a match widget for a specific style.

pws

diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index d51fd518b..1e335d29d 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -2227,7 +2227,20 @@ is set in the context tt(:zle:*) to tt(true) if the word style is
 tt(bash) and tt(false) otherwise.  It may be overridden by setting it in
 the more specific context tt(:zle:forward-word*).
 
-Here are some examples of use of the styles, actually taken from the
+It is possible to create widgets with specific behaviour by defining
+a new widget implemented by the appropriate generic function, then
+setting a style for the context of the specific widget.  For example,
+the following defines a widget tt(backward-kill-space-word) using
+tt(backward-kill-word-match), the generic widget implmenting
+tt(backward-kill-word) behaviour, and ensures that the new widget
+always implements space-delimited behaviour.
+
+example(zle -N backward-kill-space-word backward-kill-word-match
+zstyle :zle:backward-kill-space-word word-style space)
+
+The widget tt(backward-kill-space-word) can now be bound to a 
+
+Here are some further examples of use of the styles, actually taken from the
 simplified interface in tt(select-word-style):
 
 example(zstyle ':zle:*' word-style standard
@@ -2251,7 +2264,7 @@ zstyle ':zle:transpose-words:whitespace' word-style shell
 zstyle ':zle:transpose-words:filename' word-style normal
 zstyle ':zle:transpose-words:filename' word-chars '')
 
-This provides two different ways of using tt(transpose-words) depending on
+This provides two different ways of using tt(transporse-words) depending on
 whether the cursor is on whitespace between words or on a filename, here
 any word containing a tt(/).  On whitespace, complete arguments as defined
 by standard shell rules will be transposed.  In a filename, only


  reply	other threads:[~2020-01-10 10:59 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200107184011eucas1p241073778b2cdd5bf7e94b43851273d49@eucas1p2.samsung.com>
2020-01-07 18:38 ` Andrey Butirsky
2020-01-08  2:26   ` Sebastian Gniazdowski
2020-01-08  2:37     ` Andrey Butirsky
2020-01-08  4:26       ` dana
2020-01-08  9:06       ` Mikael Magnusson
2020-01-08 10:00   ` Peter Stephenson
2020-01-08 21:55     ` Andrey Butirsky
2020-01-08 22:03       ` Roman Perepelitsa
2020-01-08 22:23         ` Daniel Shahaf
2020-01-09  0:05           ` Andrey Butirsky
2020-01-09  8:45             ` Roman Perepelitsa
2020-01-09  9:27               ` Andrey
2020-01-09 10:44                 ` Roman Perepelitsa
2020-01-09 11:03           ` Roman Perepelitsa
2020-01-10 17:06             ` Daniel Shahaf
2020-01-10 17:35               ` Roman Perepelitsa
2020-01-10 18:09                 ` z-sy-h and z-asug: zle-line-pre-redraw, POSTDISPLAY, coexistence (was: Re: emulate bash key bindings) Daniel Shahaf
2020-01-10 18:14                   ` Roman Perepelitsa
2020-01-10 18:29                     ` Daniel Shahaf
2020-01-10 18:43                       ` Roman Perepelitsa
2020-01-10 19:14                         ` Daniel Shahaf
2020-01-10 22:42                         ` Sebastian Gniazdowski
2020-01-10 22:54                           ` Roman Perepelitsa
2020-01-10 23:46                             ` Sebastian Gniazdowski
2020-01-11 14:30                               ` Roman Perepelitsa
2020-01-12  2:42                                 ` Sebastian Gniazdowski
2020-01-12  2:47                                   ` Sebastian Gniazdowski
2020-01-09 14:18     ` emulate bash key bindings Andrey Butirsky
2020-01-09 14:29       ` Peter Stephenson
2020-01-10  0:46         ` Andrey Butirsky
2020-01-10  9:51           ` Peter Stephenson
2020-01-10 10:58             ` Peter Stephenson [this message]
2020-01-10 11:07               ` Peter Stephenson
2020-01-10 11:47               ` Mikael Magnusson
2020-01-10 14:00               ` Andrey Butirsky

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=1578653890.5278.5.camel@samsung.com \
    --to=p.stephenson@samsung.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).