zsh-users
 help / color / mirror / code / Atom feed
* Re: bindkey vi esc / k - beginning of line hatred
@ 2008-10-23  5:55 Jerry Rocteur
  2008-10-23 10:01 ` Peter Stephenson
  0 siblings, 1 reply; 13+ messages in thread
From: Jerry Rocteur @ 2008-10-23  5:55 UTC (permalink / raw)
  To: zsh-users

> "Jerry Rocteur" wrote:
>> 1) When I hit esc k to go back in my history, my cursor is at the end of the
>> line.. I hate this and can't live with
>> it, how do I change it so that my cursor is at the beginning of the line so I
>>  can type cw and change the command for
>> example.
>
> bindkey -M vicmd 'k' vi-up-line-or-history

Thanks Peter, it is so good to know!

jro@dhws011: bindkey -M vicmd 'k' vi-up-line-or-history
jro@dhws011: bindkey -M vicmd 'j' vi-up-line-or-history

I'm flabbergasted that

1) Anyone would want to be at the end of a line and
2) That you change the default behaviour of ksh without putting anything in the doc..

But I'm overwhelmed that it works now.

> (already bound to '-', but your fingers don't know that even if you do).

;-)

>> 2) When I hit esc / xyz to search through my history for soemthing, nothing i
>> s echoed to the screen. That is mildly
>> annoying.
>
> You should get a prompt "?" and the letters you type immediately below
> the line.  Do you mean you want incremental search behaviour, with
> matching lines appearing on the command line as you type?  For that you
> need to pick a key and bind history-incremental-search-backward to it,
> for example:
>
> bindkey -M vicmd '^R' history-incremental-search-backward


Nope, when I hit esc nothing happens, I start typing nothing happens, I hit return
and zsh searches my history for
what I typed in the blind.

Thanks again for the above!!!

Regards,

Jerry


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

* Re: bindkey vi esc / k - beginning of line hatred
  2008-10-23  5:55 bindkey vi esc / k - beginning of line hatred Jerry Rocteur
@ 2008-10-23 10:01 ` Peter Stephenson
  2008-10-23 10:07   ` Re[2]: " Vadim Zeitlin
                     ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Peter Stephenson @ 2008-10-23 10:01 UTC (permalink / raw)
  Cc: zsh-users

On Thu, 23 Oct 2008 07:55:15 +0200 (CEST)
"Jerry Rocteur" <macosx@rocteur.cc> wrote:
> I'm flabbergasted that
> 
> 1) Anyone would want to be at the end of a line and

I think the original author was a vi user, so he must have thought about
this.  Presumably he found he usually wanted to change stuff at the end of
the like.

> 2) That you change the default behaviour of ksh without putting anything
> in the doc..

zsh is a completely different shell from ksh, so there is no "changed
default".  (The history, in fact, is that its features were based on a ksh
manual page, but there was no attempt to make it a ksh clone; some effort
has gone into adding compatibility options, but the line editor in zsh is
hugely different.)  There is a list in the FAQ of major differences,
however, and this is worth adding.

> >> 2) When I hit esc / xyz to search through my history for soemthing, nothing i
> >> s echoed to the screen. That is mildly
> >> annoying.
> >
> > You should get a prompt "?" and the letters you type immediately below
> > the line.
> 
> 
> Nope, when I hit esc nothing happens, I start typing nothing happens, I
> hit return and zsh searches my history for what I typed in the blind.

This sounds like a bug, but I haven't heard of it before.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

* Re[2]: bindkey vi esc / k - beginning of line hatred
  2008-10-23 10:01 ` Peter Stephenson
@ 2008-10-23 10:07   ` Vadim Zeitlin
  2008-10-23 10:09     ` Peter Stephenson
       [not found]   ` <58839.153.98.68.197.1224760081.squirrel@webmail.rocteur.com>
  2008-10-23 16:18   ` Frank Terbeck
  2 siblings, 1 reply; 13+ messages in thread
From: Vadim Zeitlin @ 2008-10-23 10:07 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 996 bytes --]

On Thu, 23 Oct 2008 11:01:13 +0100 Peter Stephenson <pws@csr.com> wrote:

PS> On Thu, 23 Oct 2008 07:55:15 +0200 (CEST)
PS> "Jerry Rocteur" <macosx@rocteur.cc> wrote:
PS> > I'm flabbergasted that
PS> > 
PS> > 1) Anyone would want to be at the end of a line and
PS> 
PS> I think the original author was a vi user, so he must have thought about
PS> this.  Presumably he found he usually wanted to change stuff at the end of
PS> the like.

 FWIW I can confirm that some vi users (that is, at least me) do strongly
prefer being at the end of line. It's rather subjective, of course, but
here is an attempt at an objective explanation:

 If you want to execute a different command with the same arguments it's
usually faster to just type "anothercommand $_" but if you want to change
something near the end of line pressing the up arrow and editing the
previous command line is more convenient.

 To summarize, please don't change this to ksh behaviour which is IMO much
less convenient.

 Thanks,
VZ

[-- Attachment #2: Type: APPLICATION/PGP-SIGNATURE, Size: 195 bytes --]

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

* Re: Re[2]: bindkey vi esc / k - beginning of line hatred
  2008-10-23 10:07   ` Re[2]: " Vadim Zeitlin
@ 2008-10-23 10:09     ` Peter Stephenson
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Stephenson @ 2008-10-23 10:09 UTC (permalink / raw)
  To: zsh-users

Vadim Zeitlin wrote:
>  To summarize, please don't change this to ksh behaviour which is IMO much
> less convenient.

There's no question of that---it's far too late to change basic builtin
zsh behaviour that's this obvious to the user.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

* Re: bindkey vi esc / k - beginning of line hatred
       [not found]   ` <58839.153.98.68.197.1224760081.squirrel@webmail.rocteur.com>
@ 2008-10-23 11:15     ` Peter Stephenson
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Stephenson @ 2008-10-23 11:15 UTC (permalink / raw)
  To: zsh-users

"Jerry Rocteur" wrote:
> > On Thu, 23 Oct 2008 07:55:15 +0200 (CEST)
> > "Jerry Rocteur" <macosx@rocteur.cc> wrote:
> >> I'm flabbergasted that
> [... deleted]
> >>
> >> Nope, when I hit esc nothing happens, I start typing nothing happens, I
> >> hit return and zsh searches my history for what I typed in the blind.
> >
> > This sounds like a bug, but I haven't heard of it before.
> 
> I find that when I type zsh things start to happen as they should.

Does this mean you were in zsh before, but with some kind of different
environment from the one you usually use?  If so, it may still be a
bug... obviously, we'd like to know how to provoke it if you ever happen
to find out.  I presume since I haven't heard of it it must be quite
hard, so I'm not particularly worried.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

* Re: bindkey vi esc / k - beginning of line hatred
  2008-10-23 10:01 ` Peter Stephenson
  2008-10-23 10:07   ` Re[2]: " Vadim Zeitlin
       [not found]   ` <58839.153.98.68.197.1224760081.squirrel@webmail.rocteur.com>
@ 2008-10-23 16:18   ` Frank Terbeck
  2008-10-23 16:30     ` Peter Stephenson
  2 siblings, 1 reply; 13+ messages in thread
From: Frank Terbeck @ 2008-10-23 16:18 UTC (permalink / raw)
  To: zsh-users

Peter Stephenson <pws@csr.com>:
> On Thu, 23 Oct 2008 07:55:15 +0200 (CEST)
> "Jerry Rocteur" <macosx@rocteur.cc> wrote:
[...]
> > >> 2) When I hit esc / xyz to search through my history for soemthing, nothing i
> > >> s echoed to the screen. That is mildly
> > >> annoying.
> > >
> > > You should get a prompt "?" and the letters you type immediately below
> > > the line.
> > 
> > 
> > Nope, when I hit esc nothing happens, I start typing nothing happens, I
> > hit return and zsh searches my history for what I typed in the blind.
> 
> This sounds like a bug, but I haven't heard of it before.

If 'singlelinezle' is set, the user won't get that sort of feedback.

If TERM is set to 'dumb', it won't work either; but I guess that's not
a bug, but a lack of features in the terminal.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925


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

* Re: bindkey vi esc / k - beginning of line hatred
  2008-10-23 16:18   ` Frank Terbeck
@ 2008-10-23 16:30     ` Peter Stephenson
  2008-10-23 16:56       ` @ Rocteur CC
  2008-10-24  6:57       ` Jerry Rocteur
  0 siblings, 2 replies; 13+ messages in thread
From: Peter Stephenson @ 2008-10-23 16:30 UTC (permalink / raw)
  To: zsh-users

Frank Terbeck wrote:
> Peter Stephenson <pws@csr.com>:
>> On Thu, 23 Oct 2008 07:55:15 +0200 (CEST)
>> "Jerry Rocteur" <macosx@rocteur.cc> wrote:
>>>>> 2) When I hit esc / xyz to search through my history for
>>>>> soemthing, nothing is echoed to the screen.> > > 
>>> 
>>> Nope, when I hit esc nothing happens, I start typing nothing happens, I
>>> hit return and zsh searches my history for what I typed in the blind.
>> 
>> This sounds like a bug, but I haven't heard of it before.
> 
> If 'singlelinezle' is set, the user won't get that sort of feedback.

Ah, now that might be possible --- this would make the shell look (a
bit) more like ksh and you might naively think it was therefore useful
to set.  But it isn't, it's just to get around terminal weirdness
(e.g. a very small terminal); it's not designed as an alternative
fully-functional mode.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

* Re: bindkey vi esc / k - beginning of line hatred
  2008-10-23 16:30     ` Peter Stephenson
@ 2008-10-23 16:56       ` @ Rocteur CC
  2008-10-23 17:04         ` Peter Stephenson
  2008-10-24  6:57       ` Jerry Rocteur
  1 sibling, 1 reply; 13+ messages in thread
From: @ Rocteur CC @ 2008-10-23 16:56 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-users

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


On 23 Oct 2008, at 18:30, Peter Stephenson wrote:

> Frank Terbeck wrote:
>> Peter Stephenson <pws@csr.com>:
>>> On Thu, 23 Oct 2008 07:55:15 +0200 (CEST)
>>> "Jerry Rocteur" <macosx@rocteur.cc> wrote:
>>>>>> 2) When I hit esc / xyz to search through my history for
>>>>>> soemthing, nothing is echoed to the screen.> > >
>>>>
>>>> Nope, when I hit esc nothing happens, I start typing nothing  
>>>> happens, I
>>>> hit return and zsh searches my history for what I typed in the  
>>>> blind.
>>>
>>> This sounds like a bug, but I haven't heard of it before.
>>
>> If 'singlelinezle' is set, the user won't get that sort of feedback.
>
> Ah, now that might be possible --- this would make the shell look (a
> bit) more like ksh and you might naively think it was therefore useful
> to set.  But it isn't, it's just to get around terminal weirdness
> (e.g. a very small terminal); it's not designed as an alternative
> fully-functional mode.
>

I'm at home at the moment not at work and I can't log into my WS from  
home but I did take the output of setopt and unsetopt yesterday so  
that I oculd study it at home and this is what I see:

I am not sure of the usefullness of unsetopt and the no prefix but I  
guess someone once thought it was neat.. Old habits die hard ;-)

Back to single line. this line is in the output:

	nosinglelinezle       off

If no is off then singlelinezle must be on.

I'll check it tomorrow and change it and let you know if this changes  
anything.

Thanks again!

Jerry




[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2417 bytes --]

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

* Re: bindkey vi esc / k - beginning of line hatred
  2008-10-23 16:56       ` @ Rocteur CC
@ 2008-10-23 17:04         ` Peter Stephenson
  2008-10-24 13:47           ` Peter Stephenson
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Stephenson @ 2008-10-23 17:04 UTC (permalink / raw)
  To: zsh-users

"@ Rocteur CC" wrote:
> I am not sure of the usefullness of unsetopt and the no prefix but I  
> guess someone once thought it was neat.. Old habits die hard ;-)
> 
> Back to single line. this line is in the output:
> 
> 	nosinglelinezle       off
> 
> If no is off then singlelinezle must be on.

The reason it displays like that is that it shows the default state.
You're obviously in ksh emulation, where it seems singlelinezle is on by
default.  We're probably shooting ourselves in the foot over this; as I
said, it's only superficially like ksh, and it's not clear this is
really an emulation of it in a helpful sense.  Any other opinions?

Anyway, "unsetopt singlelinezle" is probably what you want.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

* Re: bindkey vi esc / k - beginning of line hatred
  2008-10-23 16:30     ` Peter Stephenson
  2008-10-23 16:56       ` @ Rocteur CC
@ 2008-10-24  6:57       ` Jerry Rocteur
  1 sibling, 0 replies; 13+ messages in thread
From: Jerry Rocteur @ 2008-10-24  6:57 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-users

> Frank Terbeck wrote:
>> Peter Stephenson <pws@csr.com>:
>>> On Thu, 23 Oct 2008 07:55:15 +0200 (CEST)
>>> "Jerry Rocteur" <macosx@rocteur.cc> wrote:
>>>>>> 2) When I hit esc / xyz to search through my history for
>>>>>> soemthing, nothing is echoed to the screen.> > >
>>>>
>>>> Nope, when I hit esc nothing happens, I start typing nothing happens, I
>>>> hit return and zsh searches my history for what I typed in the blind.
>>>
>>> This sounds like a bug, but I haven't heard of it before.
>>
>> If 'singlelinezle' is set, the user won't get that sort of feedback.
>
> Ah, now that might be possible --- this would make the shell look (a
> bit) more like ksh and you might naively think it was therefore useful
> to set.  But it isn't, it's just to get around terminal weirdness
> (e.g. a very small terminal); it's not designed as an alternative
> fully-functional mode.

Thanks very much, I tried: unsetopt singlelinezle

And I get the little question mark on the next line, I'm not used to it yet as I'm so used to 20 more years of ksh but
I think I can get used to seeing the little question mark on the next line ;-)

Thanks everyone who replied and have a GREAT weekend,

Jerry


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

* Re: bindkey vi esc / k - beginning of line hatred
  2008-10-23 17:04         ` Peter Stephenson
@ 2008-10-24 13:47           ` Peter Stephenson
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Stephenson @ 2008-10-24 13:47 UTC (permalink / raw)
  To: zsh-users

On Thu, 23 Oct 2008 18:04:05 +0100
Peter Stephenson <pws@csr.com> wrote:
> You're obviously in ksh emulation, where it seems singlelinezle is on by
> default.  We're probably shooting ourselves in the foot over this; as I
> said, it's only superficially like ksh, and it's not clear this is
> really an emulation of it in a helpful sense.  Any other opinions?

A couple of documentation enhancements based on this thread.  I updated the
latest version in the FAQ while I was at it.

Index: Doc/Zsh/options.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v
retrieving revision 1.65
diff -u -r1.65 options.yo
--- Doc/Zsh/options.yo	9 Oct 2008 13:46:45 -0000	1.65
+++ Doc/Zsh/options.yo	24 Oct 2008 13:33:06 -0000
@@ -1515,6 +1515,12 @@
 cindex(editor, single line mode)
 item(tt(SINGLE_LINE_ZLE) (tt(-M)) <K>)(
 Use single-line command line editing instead of multi-line.
+
+Note that although this is on by default in ksh emulation it only
+provides superficial compatibility with the ksh line editor and
+reduces the effectiveness of the zsh line editor.  As it has no
+effect on shell syntax, many users may wish to disable this option
+when using ksh emulation interactively.
 )
 pindex(VI)
 item(tt(VI))(
Index: Etc/FAQ.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Etc/FAQ.yo,v
retrieving revision 1.41
diff -u -r1.41 FAQ.yo
--- Etc/FAQ.yo	9 May 2008 17:35:45 -0000	1.41
+++ Etc/FAQ.yo	24 Oct 2008 13:33:06 -0000
@@ -298,7 +298,7 @@
 sect(What's the latest version?)
 
   Zsh 4.2.7 is the latest production version.  The latest development
-  version is 4.3.6; this contains support for multibyte character strings
+  version is 4.3.7; this contains support for multibyte character strings
   (such as UTF-8 locales).  All the main features for multibyte
   support are now in place, although there is some debugging work
   still to be done.
@@ -642,7 +642,13 @@
     it()  mytt(\) does not escape editing chars (use mytt(^V)).
     it()  Not all ksh bindings are set (e.g. mytt(<ESC>#); try mytt(<ESC>q)).
     it()* mytt(#) in an interactive shell is not treated as a comment by
-        default. 
+        default.
+    it()  In vi command mode the keys "k" and "j" move the cursor to the
+        end of the line.  To move the cursor to the start instead, use
+  verb(
+          bindkey -M vicmd 'k' vi-up-line-or-history
+          bindkey -M vicmd 'j' vi-down-line-or-history
+  )
   )
   it() Built-in commands:
   itemize(


-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

* Re: bindkey vi esc / k - beginning of line hatred
  2008-10-22 10:32 Jerry Rocteur
@ 2008-10-22 10:53 ` Peter Stephenson
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Stephenson @ 2008-10-22 10:53 UTC (permalink / raw)
  To: zsh-users

"Jerry Rocteur" wrote:
> 1) When I hit esc k to go back in my history, my cursor is at the end of the 
> line.. I hate this and can't live with
> it, how do I change it so that my cursor is at the beginning of the line so I
>  can type cw and change the command for
> example.

bindkey -M vicmd 'k' vi-up-line-or-history

(already bound to '-', but your fingers don't know that even if you do).

> 2) When I hit esc / xyz to search through my history for soemthing, nothing i
> s echoed to the screen. That is mildly
> annoying.

You should get a prompt "?" and the letters you type immediately below
the line.  Do you mean you want incremental search behaviour, with
matching lines appearing on the command line as you type?  For that you
need to pick a key and bind history-incremental-search-backward to it,
for example:

bindkey -M vicmd '^R' history-incremental-search-backward

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


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

* bindkey vi esc / k - beginning of line hatred
@ 2008-10-22 10:32 Jerry Rocteur
  2008-10-22 10:53 ` Peter Stephenson
  0 siblings, 1 reply; 13+ messages in thread
From: Jerry Rocteur @ 2008-10-22 10:32 UTC (permalink / raw)
  To: zsh-users

Hi,

I've searched the archives but I can't find a way to do this.

I'm a complete newbie to zsh, I'm a good candidate for zsh for dummies, and there's a couple of things bugging me that
I'd like to sort out before I really get my teeth into it (I know my way around ksh and bash and vi pretty well
though)

I don't use emacs and I've always have set -o vi in ksh and bash!

echo $ZSH_VERSION
4.2.6
setopt |egrep "vi |emacs"

emacs                 off
vi                    on

1) When I hit esc k to go back in my history, my cursor is at the end of the line.. I hate this and can't live with
it, how do I change it so that my cursor is at the beginning of the line so I can type cw and change the command for
example.

2) When I hit esc / xyz to search through my history for soemthing, nothing is echoed to the screen. That is mildly
annoying.

I've looked at the zshzle and the different bindkeys but it seems to be such a long learning curve when all I want is
two things, I'll read through the manuals later.

Thanks in advance,

Jerry


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

end of thread, other threads:[~2008-10-24 13:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-23  5:55 bindkey vi esc / k - beginning of line hatred Jerry Rocteur
2008-10-23 10:01 ` Peter Stephenson
2008-10-23 10:07   ` Re[2]: " Vadim Zeitlin
2008-10-23 10:09     ` Peter Stephenson
     [not found]   ` <58839.153.98.68.197.1224760081.squirrel@webmail.rocteur.com>
2008-10-23 11:15     ` Peter Stephenson
2008-10-23 16:18   ` Frank Terbeck
2008-10-23 16:30     ` Peter Stephenson
2008-10-23 16:56       ` @ Rocteur CC
2008-10-23 17:04         ` Peter Stephenson
2008-10-24 13:47           ` Peter Stephenson
2008-10-24  6:57       ` Jerry Rocteur
  -- strict thread matches above, loose matches on Subject: below --
2008-10-22 10:32 Jerry Rocteur
2008-10-22 10:53 ` Peter Stephenson

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