zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Andy Spiegl <zsh.Andy@spiegl.de>, zsh-users@sunsite.auc.dk
Subject: Re: two completion questions
Date: Fri, 10 Dec 1999 18:33:37 +0000	[thread overview]
Message-ID: <991210183337.ZM27395@candle.brasslantern.com> (raw)
In-Reply-To: <19991210184036.A29989@br-online.de>

On Dec 10,  6:40pm, Andy Spiegl wrote:
} Subject: two completion questions
}
} Now:  (cursor position at "_")
}  hamster:/tmp/zsh>cat a_<TAB>
} leads to
}  hamster:/tmp/zsh>cat a _
} 
} However I would expect zsh to do this:
}  hamster:/tmp/zsh>cat a_
}  file
}  a     ab    abc 
} 
} Maybe there is a switch I missed?

It would appear that you have "setopt REC_EXACT".  With that set, zsh
accepts immediately any prefix that exactly matches an existing file,
even if there are longer names that also match.

} The other problem is that zsh doesn't append a / after .. although it's a
} directory.  Here's an example again:
}  hamster:/tmp/zsh>cd .._<TAB>
} This just beeps instead of leading to this:
}  hamster:/tmp/zsh>cd ../_

I'm not precisely sure why zsh handles ".." that way.  You can fix this
with compctl completion as follows:

	compctl -D -f + -g .. -S / -q

If you're using the new function-based completion in 3.1.6, it's going to
require some editing of the _path_files completer.  Hey, Sven, do you (or
any other zsh-workers) remember the rationale for this handling of ".."?

} Actually this just reminded me of a third annoyance. :-)
} zsh removes a (previously completed) / or a space in the middle of the
} input line after C-e or C-a.

That's because you're using expand-or-complete-prefix.  (Which you must
be, or else this ...

}  hamster:/tmp>echo zs_ab     (...press TAB...)
}  hamster:/tmp>echo zsh/_ab   (...now Ctrl-E to go to the end of line...)

... would not happen at all; you'd just get a feep.)

With expand-or-complete-prefix, the stuff to the right of the cursor is
not considered to be part of the result of the completion, so as far as
zsh can tell when you follow the completion with a cursor motion rather
than an character insertion it means you didn't want the slash.

} Off course "unsetopt AUTO_REMOVE_SLASH" removes this behavior, but
} then the slash is never removed. I would expect zsh to remove the
} slash/space only if there is no character below (or to the right of)
} the cursor. Am I wrong?

Autoremoval is not based on what's on the line, it's based on what the
next action is.  Essentially, insertions cause it to remain (unless the
inserted character is the same as the suffix) and anything else causes
it to be removed.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  reply	other threads:[~1999-12-10 18:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-10 17:40 Andy Spiegl
1999-12-10 18:33 ` Bart Schaefer [this message]
1999-12-13 10:54   ` Zefram
1999-12-14 15:17   ` Andy Spiegl
1999-12-13 10:33 Sven Wischnowsky
1999-12-14 15:48 Sven Wischnowsky

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=991210183337.ZM27395@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-users@sunsite.auc.dk \
    --cc=zsh.Andy@spiegl.de \
    /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).