Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zle kill-region without mark consider start of line as mark
- X-seq: zsh-users 22985
- From: Hadrien Lacour <hadrien.lacour@xxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: zle kill-region without mark consider start of line as mark
- Date: Wed, 15 Nov 2017 19:00:56 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1510768859; bh=U22FWgaUpJDS7IIOyWPv2oPx9IuuqhrtP3sKXdGHN5Y=; h=Date:From:Subject:From; b=E3hNwjloXacgR+7GJsZQFqpWRhBb9aRQi8x8c/7SaFPlBiDxRnGEWLEsjhWrskKwR 2c7G9Dne6XpOv8TNkcLxH7a+35p/MkdXel48PV0MW4hoj2MnnVhVMt/89NlzuY7mYt ljK83A9yZR9wsHRVphxhFrQYZT42JQ3J9XgrE/1vNDpEO7XBTP4k/Syr7omBIwGYMb A4Tw5Inb9VnKjmm8VmgvJmIJqPepT5sV0UVZQqZVYt6PWR0XkbOk+Maqlu4N3nnCGs Syp5NwjPSGJbi8TkUKMw/aPPyjDmK3blmITS0NmMko4F2C/asnkv9okYkh6QBwcRTD Myh5ouX1DXXLg==
- In-reply-to: <CAHYJk3TPZ79brYzHsU0xd6QiVupVViRndWF1bq-s1RWD8rBzSg@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CGME20171115104211epcas1p297804141d5350c2100e76f849759952d@epcas1p2.samsung.com> <20171115104034.p7evb5raltjlg2ja@gentoo.gentoo> <20171115112437.4b2633c1@pwslap01u.europe.root.pri> <20171115130047.oxs4xbetcb3hzuh3@gentoo.gentoo> <20171115131326.cazeuiazwmfy5dmh@gentoo.gentoo> <CAHYJk3TPZ79brYzHsU0xd6QiVupVViRndWF1bq-s1RWD8rBzSg@mail.gmail.com>
On Wed, Nov 15, 2017 at 06:10:29PM +0100, Mikael Magnusson wrote:
> REGION_ACTIVE (integer)
> Indicates if the region is currently active. It can be
> assigned 0 or
> 1 to deactivate and activate the region
> respectively. A value of 2
> activates the region in line-wise mode with the
> highlighted text
> extending for whole lines only; see Character Highlighting below.
>
>
> On Wed, Nov 15, 2017 at 2:13 PM, Hadrien Lacour
> <hadrien.lacour@xxxxxxxxxx> wrote:
> > On Wed, Nov 15, 2017 at 02:00:47PM +0100, Hadrien Lacour wrote:
> >> On Wed, Nov 15, 2017 at 11:24:37AM +0000, Peter Stephenson wrote:
> >> > On Wed, 15 Nov 2017 11:40:34 +0100
> >> > Hadrien Lacour <hadrien.lacour@xxxxxxxxxx> wrote:
> >> > > I have `bindkey -M emacs '^W' kill-region` in my zshrc and using it without
> >> > > having set any mark will cut from the beginning of the line to the cursor.
> >> > > I've tried to read zle's doc but found no mention of this behaviour.
> >> > >
> >> > > Any idea about what's happening and how to do nothing if the mark isn't set?
> >> >
> >> > Internally, there is actually no notion of the mark not being set ---
> >> > it's simply initialised to zero, and moved when ask it to be set.
> >> > Therefore, if you try and use it, it appears as if it's at the start of
> >> > the line.
> >> >
> >> > The documentation doesn't make this explicit. It could do with
> >> > mentioning the default state.
> >> >
> >> > pws
> >>
> >> Thanks, that's what I supposed too. I almost have it fixed with
> >>
> >> markset=
> >> my-set-mark()
> >> {
> >> zle set-mark-command
> >> markset=true
> >> }
> >>
> >> my-kill-region()
> >> {
> >> [ $markset ] && zle kill-region
> >> }
> >>
> >> zle -N my-kill-region
> >> zle -N my-set-mark
> >>
> >> bindkey -M emacs '^@' my-set-mark
> >> bindkey -M emacs '^W' my-kill-region
> >>
> >>
> >> But I don't know how to reset markset every newline (other than doing an ugly
> >> bindkey for Return).
> >
> > Disregard this, I just forgot to reset markset in the second widget.
>
>
>
> --
> Mikael Magnusson
Thanks, this the perfect solution (I saw it, but didn't understand it when
reading the man). Now, I wonder why it's no the default.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author