zsh-users
 help / color / mirror / code / Atom feed
* Zsh autocompletion with no access to a parent directory
@ 2010-04-13 16:33 Matt Wright
  2010-04-13 16:45 ` Peter Stephenson
  0 siblings, 1 reply; 20+ messages in thread
From: Matt Wright @ 2010-04-13 16:33 UTC (permalink / raw)
  To: zsh-users

Hey,

I've run into a problem with autocompletion and I can't seem to find anything about it from googling. Hopefully someone might be able to help.

The situation is this: At work we make fairly heavy use of network home directories. In one particular case some important scripts live in ~foo/bin, however, the actually home directory of ~foo is not accessible. This appears to give _path_files a big headache, as trying to type the following results in no completion suggestions.

# ~foo/bin/<TAB>

As far as I can tell from my attempts to parse the debugging output, it is attempting to traverse ~foo for path expansion? I was attempting to look for a way to disable path expansion (the /u/l/b -> /usr/local/bin stuff) while leaving normal filename suggestion intact. Either that, or a way to alter _path_files such that it doesn't die in this situation.

Any ideas?

Regards,

Matt

^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: Zsh autocompletion with no access to a parent directory
@ 2010-06-25 12:27 Yves Frederix
  0 siblings, 0 replies; 20+ messages in thread
From: Yves Frederix @ 2010-06-25 12:27 UTC (permalink / raw)
  To: zsh-users

Hi all,

I have recently switched from bash to zsh and I am loving it. However,
there are still issues I didn't experience with bash. One of them is
the fact that tabcompletion was not able to cross unreadable parent
directories. With the solution proposed in this thread, this now works
more or less, but not completely... The problem seems to be related to
the use of ~user to access the homedirectory of 'user'.

A minimal example:
  testuser@dirac:~$ ls -ld Desktop/
  drwx--x--x 3 testuser testuser 4096 2010-06-25 09:33 Desktop/

  testuser@dirac:~$ ls -ld Desktop/work/
  drwxr-xr-x 2 testuser testuser 4096 2010-06-25 09:33 Desktop/work/

  testuser@dirac:~$ find Desktop/
  Desktop/
  Desktop/work
  Desktop/work/file2
  Desktop/work/file3
  Desktop/work/file4
  Desktop/work/file1

If I do (with accept-exact-dirs set to true):

  yves@dirac ~$ ls ~testuser/Desktop/work/<tab><tab>

nothing happens.

However, using the full path name:

  dirac ~$ ls /home/testuser/Desktop/work/<tab><tab>
  dirac ~$ ls /home/testuser/Desktop/work/file
  - files -
  file1  file2  file3  file4

So now it works. What could be going on here, and is there a way to
make the form with ~ work as well? Thanks!

Cheers,
YVES

On Tue, 13 Apr 2010 09:33:15 -0700
Matt Wright <matt@xxxxxxxxxxxx> wrote:
> The situation is this: At work we make fairly heavy use of network home
> directories. In one particular case some important scripts live in
> ~foo/bin, however, the actually home directory of ~foo is not
> accessible. This appears to give _path_files a big headache, as trying to
> type the following results in no completion suggestions.
>
> # ~foo/bin/<TAB>
>
> As far as I can tell from my attempts to parse the debugging output, it
> is attempting to traverse ~foo for path expansion? I was attempting to look
> for a way to disable path expansion (the /u/l/b -> /usr/local/bin stuff)
> while leaving normal filename suggestion intact. Either that, or a way to
> alter _path_files such that it doesn't die in this situation.

You can try telling completion to accept any directory that it knows exists
without trying to expand the path:

zstyle ':completion:*' accept-exact-dirs true

I'm not sure if this will help in the case you're describing, however,
since it looks like it might not be able to tell if the directory exists.
You'll need zsh 4.3.

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in
England and Wales, registered number 4187346, registered office
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4
0WZ, United Kingdom


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

end of thread, other threads:[~2010-08-03 13:00 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-13 16:33 Zsh autocompletion with no access to a parent directory Matt Wright
2010-04-13 16:45 ` Peter Stephenson
2010-04-13 17:11   ` Matt Wright
2010-04-13 20:33   ` Matt Wright
2010-04-14  9:14     ` Peter Stephenson
2010-04-14  9:47       ` Peter Stephenson
2010-04-14 10:01         ` Peter Stephenson
2010-04-14 17:20           ` Matt Wright
2010-04-23 15:01         ` Matt Wright
2010-04-23 21:44           ` Peter Stephenson
2010-04-29 21:38             ` Peter Stephenson
2010-04-29 22:14               ` Matt Wright
2010-04-30  8:32                 ` Peter Stephenson
2010-04-30 16:05                   ` Matt Wright
2010-05-05  4:55                   ` Matt Wright
2010-05-05  9:58                     ` Peter Stephenson
2010-07-29 15:46                   ` Matt Wright
2010-08-03 12:59                     ` Peter Stephenson
2010-04-30 16:14               ` Bart Schaefer
2010-06-25 12:27 Yves Frederix

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