zsh-users
 help / color / mirror / code / Atom feed
* two completion questions
@ 1999-12-10 17:40 Andy Spiegl
  1999-12-10 18:33 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Spiegl @ 1999-12-10 17:40 UTC (permalink / raw)
  To: zsh-users

Hi!

I switched to zsh a few month ago and I like it better every day!

There are just two annoying things:

When completing filenames that start with the same prefix which I have
typed already, zsh doesn't show me the other possibilities.  It's a bit
difficult to explain.  I'll better show you an example:

 hamster:/tmp/zsh>ls -l
 total 0
 -rw-r-----   1 spiegl   users           0 Dec 10 18:16 a
 -rw-r-----   1 spiegl   users           0 Dec 10 18:16 ab
 -rw-r-----   1 spiegl   users           0 Dec 10 18:16 abc
 hamster:/tmp/zsh>ls -l

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?


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 ../_


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.  Example again:
 hamster:/tmp>echo ab_       (then I go back two columns...)
 hamster:/tmp>echo _ab       (...insert a directory...)
 hamster:/tmp>echo zs_ab     (...press TAB...)
 hamster:/tmp>echo zsh/_ab   (...now Ctrl-E to go to the end of line...)
 hamster:/tmp>echo zshab_

...and zsh removed the slash. :-(
The same happens if I let zsh not only complete the directory but a file.
The appended space is removed as soon as I move the cursor.

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? 

But otherwise I really love zsh!  Thanks for the great work!!!
 Andy.
-- 
 E-Mail: Andy@spiegl.de     URL: http://andy.spiegl.de
 PGP/GPG: see headers
                                o      _     _         _
  --------- __o       __o      /\_   _ \\o  (_)\__/o  (_)
  ------- _`\<,_    _`\<,_    _>(_) (_)/<_    \_| \   _|/' \/
  ------ (_)/ (_)  (_)/ (_)  (_)        (_)   (_)    (_)'  _\o_
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 This is a message from God: "Rebooting the universe, please log off." 


^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: two completion questions
@ 1999-12-13 10:33 Sven Wischnowsky
  0 siblings, 0 replies; 6+ messages in thread
From: Sven Wischnowsky @ 1999-12-13 10:33 UTC (permalink / raw)
  To: zsh-users


Bart Schaefer wrote:

> ...
> 
> 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 ".."?

In _path_files it's because globbing never produces . and ..

About compctl: I only vaguely remember lots of discussions about these 
two special cases.


Anyway, here's the patch for _path_files, for the latest version.

To tell you the truth: this also fixes two typos that made files not
starting with a dot not be used as possible completions if glob_dots
was unset and the string on the line started with a dot.

Bye
 Sven

diff -ru ../z.old/Completion/Core/_path_files Completion/Core/_path_files
--- ../z.old/Completion/Core/_path_files	Mon Dec 13 11:24:11 1999
+++ Completion/Core/_path_files	Mon Dec 13 11:27:49 1999
@@ -225,11 +225,11 @@
     if [[ "$tpre$tsuf" = */* ]]; then
       tmp2=( ${^tmp1}*(-/) )
       [[ ! -o globdots && "$PREFIX" = .* ]] &&
-          tmp2=( "$tmp1[@]" ${^tmp1}.*(-/) )
+          tmp2=( "$tmp2[@]" ${^tmp1}.*(-/) . .. )
     else
       tmp2=( ${^tmp1}${^~pats} )
       [[ ! -o globdots && "$PREFIX" = .* ]] &&
-          tmp2=( "$tmp1[@]" ${^tmp1}.${^~pats} )
+          tmp2=( "$tmp2[@]" ${^tmp1}.${^~pats} . .. )
     fi
     tmp1=( "$tmp2[@]" )
 

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: two completion questions
@ 1999-12-14 15:48 Sven Wischnowsky
  0 siblings, 0 replies; 6+ messages in thread
From: Sven Wischnowsky @ 1999-12-14 15:48 UTC (permalink / raw)
  To: zsh-users


Andy Spiegl wrote:

> > 	compctl -D -f + -g .. -S / -q
> Hm, I tried that before I saw Sven's patch, but it doesn't change anything.
> Probably because I am using the new function-based completion.  Is compctl
> useless in that case?  Or can the two methods be combined?

They can, see the file `Base/_default'. BUT: you don't want to do
that. It's naughty. Only there for people who already have lots of
compctls and want to be able to use them when moving to the new
completion system.

At least, that's how it's intended to be used ;-)

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

end of thread, other threads:[~1999-12-14 15:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-10 17:40 two completion questions Andy Spiegl
1999-12-10 18:33 ` Bart Schaefer
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

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