zsh-users
 help / color / mirror / code / Atom feed
From: "Peter Slížik" <peter.slizik@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh <zsh-users@zsh.org>
Subject: Re: A wrong bindkey command breaks the way bck-i-search (Ctrl+R) works
Date: Tue, 27 Jul 2021 17:09:02 +0200	[thread overview]
Message-ID: <CAC-uhUA0zwNeN2e8JJSoLTKjzT44A5Z+yxHYveBfUPMj3-Wo2Q@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Y9FG=sZn1+KgdA9=ec7rCZKGEmPQOxcr+bD5JUjAwqiA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1688 bytes --]

Thank you very much for all the answers. If I may have one more question -
hopefully the last one on this topic. ;-)

As I mentioned before, I used a similar function to take care of " and '
characters.
- Pressing a " inserts two of them and places the cursor inside the pair.
Pressing an ' works in a similar fashion.
- Pressing a backspace inside the pair ("|" or '|', where | is the cursor)
deletes both quotes - the left and the right at the same time.

Now, binding the backspace breaks it for isearch.

zle -N insert-single-quotes _insert_single_quotes
zle -N insert-double-quotes _insert_double_quotes
zle -N remove-quotes _remove_quotes
bindkey "'" insert-single-quotes    # " ' "
bindkey '"' insert-double-quotes    # ' " '
bindkey "^?" remove-quotes    # backspace remove the whole pair
bindkey -M isearch '^?' self-insert    # This does NOT restore the original
functionality.

Instead of restoring the original functionality (deleting the last char),
^? is just inserted into the searched text.

Best regards,
Peter


уто, 27. јул 2021. у 16:51 Bart Schaefer <schaefer@brasslantern.com> је
написао/ла:

> On Tue, Jul 27, 2021 at 3:31 AM Peter Slížik <peter.slizik@gmail.com>
> wrote:
> >
> > bindkey -M emacs ' ' expand_abbreviations
> >
> > But alas, this changes the behavior of isearch, too. The documentation
> is really sometimes too wordy and, in cases like this, too terse.
>
> I think that's because emacs == main and isearch is initialized from
> main ... so if you did that bindkey but only after isearch was
> initialized, it might work.  I don't know how you assure that order of
> events, though.
>

[-- Attachment #2: Type: text/html, Size: 2428 bytes --]

  reply	other threads:[~2021-07-27 15:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-26 14:13 Peter Slížik
2021-07-26 15:58 ` Mikael Magnusson
2021-07-26 21:10   ` Bart Schaefer
2021-07-27 10:31     ` Peter Slížik
2021-07-27 14:51       ` Bart Schaefer
2021-07-27 15:09         ` Peter Slížik [this message]
2021-07-27 15:42           ` Bart Schaefer
2021-07-27 15:44             ` Peter Slížik
2021-07-27 22:35         ` Mikael Magnusson
2021-07-27 22:38           ` Bart Schaefer

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=CAC-uhUA0zwNeN2e8JJSoLTKjzT44A5Z+yxHYveBfUPMj3-Wo2Q@mail.gmail.com \
    --to=peter.slizik@gmail.com \
    --cc=schaefer@brasslantern.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).