zsh-users
 help / color / mirror / code / Atom feed
* make zsh completion ergonomics closer to those of bash?
@ 2010-02-03 21:03 Ian Clarke
  2010-02-03 21:27 ` Matias Graña
  0 siblings, 1 reply; 11+ messages in thread
From: Ian Clarke @ 2010-02-03 21:03 UTC (permalink / raw)
  To: zsh-users

This has been driving me nuts, I've asked in a variety of places and
the responses have all been a slightly more verbose version of RTFM.
I've tried to RTFM repeatedly, but have been unsuccessful in finding
what I need, which is:

When I hit the tab key, the first autocompletion is filled out
automatically, and you need to cycle through the completions by
hitting tab repeatedly (or using the arrow keys).

This differs from bash, where you are just shown a list of the
completions. If all completions have the same prefix, then this prefix
is filled out. You can select the one you want by continuing to type
and hitting tab again.

I find the latter preferable since it is faster to type, than to
navigate to a completion in a menu.  Also I'm used to it (and 15 years
of habit are hard to change!).

Is there any way to make zsh completion act more like bash in this regard?

If you are going to refer me to the manual, I would at least ask that
you be specific, since I've already read a bunch of manual pages
related to completion which did not answer my specific question.

Thanks,

Ian.

--
Ian Clarke
CEO, SenseArray
Email: ian@sensearray.com
Ph: +1 512 422 3588


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

* Re: make zsh completion ergonomics closer to those of bash?
  2010-02-03 21:03 make zsh completion ergonomics closer to those of bash? Ian Clarke
@ 2010-02-03 21:27 ` Matias Graña
  2010-02-03 21:33   ` Ian Clarke
  0 siblings, 1 reply; 11+ messages in thread
From: Matias Graña @ 2010-02-03 21:27 UTC (permalink / raw)
  To: Ian Clarke, zsh-users

On Wed, Feb 3, 2010 at 6:03 PM, Ian Clarke <ian@sensearray.com> wrote:
> When I hit the tab key, the first autocompletion is filled out
> automatically, and you need to cycle through the completions by
> hitting tab repeatedly (or using the arrow keys).
>
> Is there any way to make zsh completion act more like bash in this regard?
>

After a long try/error session, I've found a few days ago that the
variable MENUCOMPLETE had a lot to do with this.
See if you have "setopt MENUCOMPLETE" somewhere in your rc's and try
to comment it out.

-- Matías Graña


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

* Re: make zsh completion ergonomics closer to those of bash?
  2010-02-03 21:27 ` Matias Graña
@ 2010-02-03 21:33   ` Ian Clarke
  2010-02-03 21:56     ` Benjamin R. Haskell
  0 siblings, 1 reply; 11+ messages in thread
From: Ian Clarke @ 2010-02-03 21:33 UTC (permalink / raw)
  To: Matias Graña; +Cc: zsh-users

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

On Wed, Feb 3, 2010 at 3:27 PM, Matias Graña <matias.alejo@gmail.com> wrote:

> On Wed, Feb 3, 2010 at 6:03 PM, Ian Clarke <ian@sensearray.com> wrote:
> > When I hit the tab key, the first autocompletion is filled out
> > automatically, and you need to cycle through the completions by
> > hitting tab repeatedly (or using the arrow keys).
> >
> > Is there any way to make zsh completion act more like bash in this
> regard?
>
> After a long try/error session, I've found a few days ago that the
> variable MENUCOMPLETE had a lot to do with this.
> See if you have "setopt MENUCOMPLETE" somewhere in your rc's and try
> to comment it out.
>

Thanks Matías, unfortunately I couldn't find MENUCOMPLETE anywhere in my
.zshrc or any file sourced from it.   I tried typing "unsetopt MENUCOMPLETE"
but it didn't help :-(

Ian.

-- 
Ian Clarke
CEO, SenseArray
Email: ian@sensearray.com
Ph: +1 512 422 3588

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

* Re: make zsh completion ergonomics closer to those of bash?
  2010-02-03 21:33   ` Ian Clarke
@ 2010-02-03 21:56     ` Benjamin R. Haskell
  2010-02-03 22:19       ` Ian Clarke
  0 siblings, 1 reply; 11+ messages in thread
From: Benjamin R. Haskell @ 2010-02-03 21:56 UTC (permalink / raw)
  To: Ian Clarke; +Cc: zsh-users

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

On Wed, 3 Feb 2010, Ian Clarke wrote:

> On Wed, Feb 3, 2010 at 3:27 PM, Matias Graña <matias.alejo@gmail.com> wrote:
> 
> > On Wed, Feb 3, 2010 at 6:03 PM, Ian Clarke <ian@sensearray.com> wrote:
> > > When I hit the tab key, the first autocompletion is filled out 
> > > automatically, and you need to cycle through the completions by 
> > > hitting tab repeatedly (or using the arrow keys).
> > >
> > > Is there any way to make zsh completion act more like bash in this 
> > > regard?
> >
> > After a long try/error session, I've found a few days ago that the 
> > variable MENUCOMPLETE had a lot to do with this.  See if you have 
> > "setopt MENUCOMPLETE" somewhere in your rc's and try to comment it 
> > out.
> >
> 
> Thanks Matías, unfortunately I couldn't find MENUCOMPLETE anywhere in 
> my .zshrc or any file sourced from it.   I tried typing "unsetopt 
> MENUCOMPLETE" but it didn't help :-(
> 

nomenucomplete (synonym for unsetopt menucomplete) is the default.

Using zsh-4.3.10, the only completion-related option I have is:

$ setopt | grep -E 'comp|menu'
noautomenu

(i.e. 'setopt noautomenu' or 'unsetopt automenu')

Firing up bash-4.something it appears to work the same.

If that doesn't work for you, your distribution might set something up 
in /etc{,/zsh}/{,z{,sh}}{profile,env,rc}
(i.e. a bunch of places w/ or w/o a preceding zsh in the name of the 
file or directory.)

I always look in 'man zshall', since I never know what submanual things 
are in.  For more information on this in zshall, you can find options 
relevant to completion by searching 2-3 times for 'Completion' or once 
for 'ALWAYS_LAST_PROMPT'.

In this particular instance, you should also take a look at 'man 
zshoptions', which starts off with a description of the ways to specify 
options (i.e. the facts that 'AUTO_MENU' is equivalent to 'automenu' and 
that 'noautomenu' is equivalent to 'unsetopt automenu'.)

I also see BASH_AUTO_LIST (i.e. 'setopt bashautolist'), which might have 
relevance here.

-- 
Best,
Ben

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

* Re: make zsh completion ergonomics closer to those of bash?
  2010-02-03 21:56     ` Benjamin R. Haskell
@ 2010-02-03 22:19       ` Ian Clarke
  2010-02-03 22:46         ` Benjamin R. Haskell
  0 siblings, 1 reply; 11+ messages in thread
From: Ian Clarke @ 2010-02-03 22:19 UTC (permalink / raw)
  To: Benjamin R. Haskell; +Cc: zsh-users

Thanks Ben, unfortunately no luck :-( -

On Wed, Feb 3, 2010 at 3:56 PM, Benjamin R. Haskell <zsh@benizi.com> wrote:
> nomenucomplete (synonym for unsetopt menucomplete) is the default.
>
> Using zsh-4.3.10, the only completion-related option I have is:
>
> $ setopt | grep -E 'comp|menu'
> noautomenu

I see the same:
$ setopt | grep -E 'comp|menu'
noautomenu

I've added these lines to the bottom of my .zshrc:

setopt listambiguous
setopt noautomenu
setopt noautolist
setopt nomenucomplete

Unfortunately it has had no noticeable effect on the auto-completion
behavior :-(

Incidentally, I'm using the default zsh on OSX 10.6 - zsh 4.3.9
(i386-apple-darwin10.0)

Ian.

-- 
Ian Clarke
CEO, SenseArray
Email: ian@sensearray.com
Ph: +1 512 422 3588


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

* Re: make zsh completion ergonomics closer to those of bash?
  2010-02-03 22:19       ` Ian Clarke
@ 2010-02-03 22:46         ` Benjamin R. Haskell
  2010-02-04  0:17           ` Ian Clarke
  0 siblings, 1 reply; 11+ messages in thread
From: Benjamin R. Haskell @ 2010-02-03 22:46 UTC (permalink / raw)
  To: Ian Clarke; +Cc: zsh-users

On Wed, 3 Feb 2010, Ian Clarke wrote:

> Thanks Ben, unfortunately no luck :-( -
> 
> On Wed, Feb 3, 2010 at 3:56 PM, Benjamin R. Haskell <zsh@benizi.com> wrote:
> > nomenucomplete (synonym for unsetopt menucomplete) is the default.
> >
> > Using zsh-4.3.10, the only completion-related option I have is:
> >
> > $ setopt | grep -E 'comp|menu'
> > noautomenu
> 
> I see the same:
> $ setopt | grep -E 'comp|menu'
> noautomenu
> 
> I've added these lines to the bottom of my .zshrc:
> 
> setopt listambiguous
> setopt noautomenu
> setopt noautolist
> setopt nomenucomplete
> 
> Unfortunately it has had no noticeable effect on the auto-completion 
> behavior :-(
> 
> Incidentally, I'm using the default zsh on OSX 10.6 - zsh 4.3.9 
> (i386-apple-darwin10.0)
> 

Did you try 'setopt bashautolist'?

Otherwise, let's be sure the defaults are the same...

$ set -o | grep -E 'menu|autolist|listam'
noautolist            off
noautomenu            on
bashautolist          off
nolistambiguous       off
menucomplete          off

...and be sure we're talking about the same behavior.

Using zsh, create a test directory:

$ mkdir ~/zshcomptest
$ touch ~/zshcomptest/{afile,bfile,commonprefix{aaa{a,b},ccc}}
$ cd ~/zshcomptest
$ cat <TAB>* (cursor stays in same place)
afile             commonprefixaaaa  commonprefixccc
bfile             commonprefixaaab
$ cat a<TAB> (completes to:)
$ cat afile
$ cat c<TAB>* (completes partial, w/ no list, to:)
$ cat commonprefix
$ cat commonprefix<TAB>* (tab again, gets the list:)
commonprefixaaaa  commonprefixaaab  commonprefixccc

The only difference I see is in how many times I have to hit '<TAB>' 
before getting a list in bash (an extra <TAB> is required at the '*'s).  
With 'setopt bashautolist', I get the same exact behavior.

-- 
Best,
Ben


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

* Re: make zsh completion ergonomics closer to those of bash?
  2010-02-03 22:46         ` Benjamin R. Haskell
@ 2010-02-04  0:17           ` Ian Clarke
  2010-02-04  1:37             ` Ian Clarke
  0 siblings, 1 reply; 11+ messages in thread
From: Ian Clarke @ 2010-02-04  0:17 UTC (permalink / raw)
  To: Benjamin R. Haskell; +Cc: zsh-users

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

On Wed, Feb 3, 2010 at 4:46 PM, Benjamin R. Haskell <zsh@benizi.com> wrote:

> Did you try 'setopt bashautolist'?
>
> Otherwise, let's be sure the defaults are the same...
>
> $ set -o | grep -E 'menu|autolist|listam'
> noautolist            off
> noautomenu            on
> bashautolist          off
> nolistambiguous       off
> menucomplete          off
>

I had some different settings, but now I get the same as you, but the
behavior isn't what I'm looking for:

%  set -o | grep -E 'menu|autolist|listam'
 ~
noautolist            off
noautomenu            on
bashautolist          off
nolistambiguous       off
menucomplete          off
% cd /tmp/zshcomptest
  ~
% cat <tab>afile
 /tmp/zshcomptest
afile             commonprefixaaaa  commonprefixccc
bfile             commonprefixaaab

So I hit <tab> once, and immediately "afile" is printed and the cursor moves
to the end of "afile".

Similarly, if I type:

% cat comm<tab>

Immediately, I get:

% cat commonprefixaaaa

(along with a list of the available options below).

It is the fact that it automatically fills out the completion with the first
option the first time that I hit <tab> that I'm trying to avoid :-/

Ian.

-- 
Ian Clarke
CEO, SenseArray
Email: ian@sensearray.com
Ph: +1 512 422 3588

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

* Re: make zsh completion ergonomics closer to those of bash?
  2010-02-04  0:17           ` Ian Clarke
@ 2010-02-04  1:37             ` Ian Clarke
  2010-02-04  4:05               ` Andrey Borzenkov
  2010-02-04  4:31               ` Benjamin R. Haskell
  0 siblings, 2 replies; 11+ messages in thread
From: Ian Clarke @ 2010-02-04  1:37 UTC (permalink / raw)
  To: Benjamin R. Haskell; +Cc: zsh-users

On Wed, Feb 3, 2010 at 6:17 PM, Ian Clarke <ian@sensearray.com> wrote:
> I had some different settings, but now I get the same as you, but the
> behavior isn't what I'm looking for:

Just a note that I have all the same problems even when I start zsh
with the "-fx" options (which I believe prevent it from reading its
config files).

Ian.

-- 
Ian Clarke
CEO, SenseArray
Email: ian@sensearray.com
Ph: +1 512 422 3588


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

* Re: make zsh completion ergonomics closer to those of bash?
  2010-02-04  1:37             ` Ian Clarke
@ 2010-02-04  4:05               ` Andrey Borzenkov
  2010-02-04  4:21                 ` Ian Clarke
  2010-02-04  4:31               ` Benjamin R. Haskell
  1 sibling, 1 reply; 11+ messages in thread
From: Andrey Borzenkov @ 2010-02-04  4:05 UTC (permalink / raw)
  To: zsh-users, Ian Clarke

[-- Attachment #1: Type: Text/Plain, Size: 797 bytes --]

On Thursday 04 of February 2010 04:37:00 Ian Clarke wrote:
> On Wed, Feb 3, 2010 at 6:17 PM, Ian Clarke <ian@sensearray.com> wrote:
> > I had some different settings, but now I get the same as you, but
> > the
> 
> > behavior isn't what I'm looking for:
> Just a note that I have all the same problems even when I start zsh
> with the "-fx" options (which I believe prevent it from reading its
> config files).
> 


zsh -f still reads /etc/zshenv or whatever is configured on OS/X for it.

I cannot reproduce it on Linux with empty /etc/zshenv. Running zsh -f 
starts with menucomplete and new completion system both disabled and 
gives mostly behaviour you want as was already noted.

If it does not work for you after zsh -f, you really should raise it 
with your distro ...

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: make zsh completion ergonomics closer to those of bash?
  2010-02-04  4:05               ` Andrey Borzenkov
@ 2010-02-04  4:21                 ` Ian Clarke
  0 siblings, 0 replies; 11+ messages in thread
From: Ian Clarke @ 2010-02-04  4:21 UTC (permalink / raw)
  To: Andrey Borzenkov; +Cc: zsh-users

On Wed, Feb 3, 2010 at 10:05 PM, Andrey Borzenkov <arvidjaar@gmail.com> wrote:
> On Thursday 04 of February 2010 04:37:00 Ian Clarke wrote:
> zsh -f still reads /etc/zshenv or whatever is configured on OS/X for it.
>
> I cannot reproduce it on Linux with empty /etc/zshenv. Running zsh -f
> starts with menucomplete and new completion system both disabled and
> gives mostly behaviour you want as was already noted.
>
> If it does not work for you after zsh -f, you really should raise it
> with your distro ...

Oh weird, I disabled "oh-my-zsh" in my config and now it seems to
work.  Its bizarre because I was sure I tried this before :-/

Many thanks to everyone for your help.

Ian.

-- 
Ian Clarke
CEO, SenseArray
Email: ian@sensearray.com
Ph: +1 512 422 3588


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

* Re: make zsh completion ergonomics closer to those of bash?
  2010-02-04  1:37             ` Ian Clarke
  2010-02-04  4:05               ` Andrey Borzenkov
@ 2010-02-04  4:31               ` Benjamin R. Haskell
  1 sibling, 0 replies; 11+ messages in thread
From: Benjamin R. Haskell @ 2010-02-04  4:31 UTC (permalink / raw)
  To: Ian Clarke; +Cc: zsh-users

On Wed, 3 Feb 2010, Ian Clarke wrote:

> On Wed, Feb 3, 2010 at 6:17 PM, Ian Clarke wrote:
> > I had some different settings, but now I get the same as you, but 
> > the behavior isn't what I'm looking for:
> 
> Just a note that I have all the same problems even when I start zsh 
> with the "-fx" options (which I believe prevent it from reading its 
> config files).
> 

The 'x' in -fx enables XTRACE, which traces everything, but that should 
get you a clean start.  Maybe add the '+d' flag (zsh -f +d) which 
disables global rc files.  (I think only /etc/zshprofile can't be 
disabled.)

One other possibility is to check your key bindings.  I just noticed 
that there are 'menu-complete' and 'menu-expand-or-complete' bindings.  
Try:

$ bindkey | grep menu

If I first do:

$ bindkey '^I' menu-expand-or-complete
(^I is '<TAB>')

I get 'menu-complete' behavior regardless of the menucomplete setting.

Another (remote) possibility would be to check zstyle:

$ zstyle

That shouldn't list anything in a clean install.  Someone else can 
correct me if I'm wrong, but some of the things you can set with styles 
appear to involve menu completion.

-- 
Best,
Ben


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

end of thread, other threads:[~2010-02-04  4:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-03 21:03 make zsh completion ergonomics closer to those of bash? Ian Clarke
2010-02-03 21:27 ` Matias Graña
2010-02-03 21:33   ` Ian Clarke
2010-02-03 21:56     ` Benjamin R. Haskell
2010-02-03 22:19       ` Ian Clarke
2010-02-03 22:46         ` Benjamin R. Haskell
2010-02-04  0:17           ` Ian Clarke
2010-02-04  1:37             ` Ian Clarke
2010-02-04  4:05               ` Andrey Borzenkov
2010-02-04  4:21                 ` Ian Clarke
2010-02-04  4:31               ` Benjamin R. Haskell

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