zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-users@zsh.org
Subject: Re: change behaviour of command line completion
Date: Wed, 27 May 2015 12:55:49 +0100	[thread overview]
Message-ID: <20150527125549.4961ffde@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CA+chMgvdSfqBY6nimCJZLN0iH9SiTKqBtoFq51PuqQNdzCTBJA@mail.gmail.com>

On Wed, 27 May 2015 13:36:56 +0200
ruud grosmann <r.grosmann@gmail.com> wrote:
> In the old situation, when I was in a directory with only one file,
> 'example.txt' and I typed 'ls x<TAB>', no completion followed. Because
> no files start with an 'x'.
> But now, zsh happily changes the x to 'example.txt', because the x is
> in 'example.txt'. I rather don't want this behaviour, but I cannot
> find in the documentation of the options anything that describes this.

I'm assuming ohmyzsh uses the new completion system...  I have no idea
about ohmyzsh so I'm referring to the underlying shell to look for what
might be causing it.

This could be various things...


1. Approximate completion.  In other words, it's correcting what you
type and then trying to complete that.  So it thinks you "mistyped" by
omitting the "e" from "example.txt".

Do

  zstyle -L | grep -w completer

and look for something like:

  zstyle ':completion:*' completer _oldlist _expand _user_expand _complete _ignored _approximate

(This is mine, not ohmyzsh.)

If you see that "_approximate" (or also "_correct") you want to remove
those.  Using exactly the same line with that word or those words
removed will do the trick (the output in that form gives you a valid
command line you can put in .zshrc).  In this case, for example:

  zstyle ':completion:*' completer _oldlist _expand _user_expand _complete _ignored


2. Matcher control.  This allows you to update the rules that compare
what's on the command line with the trial matches.  This is probably
less likely, but it's certainly possible to set the sehll up like this.

Do

  zstyle -L | grep matcher-list

and look for something like:

  zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} r:|[[:punct:]]=* r:|=*'

As matcher control is complicated, the simplest thing to do is remove
arguments from the end and enter the corresponding line until the
problem goes away.  Put very briefly, things like 'r:|=*' and 'l:|=*'
are what might be causing the problem as they're allowing the completion
system to add anything at one end or other of the string.  Obviously,
adding things at the end isn't usually a problem so I'd worry more about
things looking like 'l:|=*'.


Hope that's enough to track it down.

pws


  reply	other threads:[~2015-05-27 12:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27 11:36 ruud grosmann
2015-05-27 11:55 ` Peter Stephenson [this message]
2015-05-27 13:03   ` Peter Stephenson
2015-05-27 21:14     ` Andrew Janke
2015-05-28  8:15       ` ruud grosmann

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=20150527125549.4961ffde@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.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).