zsh-users
 help / color / mirror / code / Atom feed
* Line number in multline editing buffer?
@ 2014-09-26  9:00 Joep van Delft
  2014-09-27  5:00 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Joep van Delft @ 2014-09-26  9:00 UTC (permalink / raw)
  To: zsh-users

Hi there, 

I did not manage to find a way to determine the current line number
in a multiline buffer (the one after a history operation, so without
the $PS2)? I often put the cursor already somewhere where where I want
to make an edit, and then realize that I'd like to use an editor
instead, and run edit-command-line. I'd fancy the cursor to end up in
the exact same location as it was in the buffer. Would there be a way
to achieve this? 

Thanks! 

Joep



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Line number in multline editing buffer?
  2014-09-26  9:00 Line number in multline editing buffer? Joep van Delft
@ 2014-09-27  5:00 ` Bart Schaefer
  2014-09-27 20:26   ` Joep van Delft
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2014-09-27  5:00 UTC (permalink / raw)
  To: zsh-users

On Sep 26, 11:00am, Joep van Delft wrote:
}
} I did not manage to find a way to determine the current line number
} in a multiline buffer (the one after a history operation, so without
} the $PS2)?

The line number should be given by

    $(( ${#LBUFFER//[^$'\n']/} + 1 ))

I leave it to you to hack up edit-command-line to pass that to your
editor in the proper way ...


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Line number in multline editing buffer?
  2014-09-27  5:00 ` Bart Schaefer
@ 2014-09-27 20:26   ` Joep van Delft
  0 siblings, 0 replies; 3+ messages in thread
From: Joep van Delft @ 2014-09-27 20:26 UTC (permalink / raw)
  To: zsh-users

On Fri, 26 Sep 2014 22:00:48 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:

> On Sep 26, 11:00am, Joep van Delft wrote:
> }
> } I did not manage to find a way to determine the current line
> number } in a multiline buffer (the one after a history operation,
> so without } the $PS2)?
> 
> The line number should be given by
> 
>     $(( ${#LBUFFER//[^$'\n']/} + 1 ))
> 
> I leave it to you to hack up edit-command-line to pass that to your
> editor in the proper way ...
> 

Excellent, thank you, Bart! 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-27 20:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-26  9:00 Line number in multline editing buffer? Joep van Delft
2014-09-27  5:00 ` Bart Schaefer
2014-09-27 20:26   ` Joep van Delft

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).