Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: cd ..<tab>?



Bart Schaefer wrote:

On Feb 5,  6:19pm, Dennis Haney wrote:
}
} Bart Schaefer wrote:
} } >>Is there a way to make this work properly with setopt GLOB_DOTS?
} >

} It want to ignore '..' when it is a stupid choice.
} eg.
} mkdir Z
} cd Z/[tab]
} should NOT complete to 'cd Z/../'
} (unless CHASE_DOTS is on and 'cd Z/..' will be different from 'cd .')

This is a case where you need 'zstyle -e'.  You want the special-dirs
style to be non-empty only in certain circumstances.

This completes `..' only if the prefix is either empty, or has a leading
`.' and contains no slashes:

   zstyle -e ':completion:*' special-dirs \
       '[[ $PREFIX = (|.[^/]#) ]] && reply=(..)'

heh Thanks. I didnt know I could run a "script" here :)

zstyle -e ':completion:*' special-dirs \
  '[[ $PREFIX = (../)#(|.|..) ]] && reply=(..)'

This will continue to work with cd ../../../..[tab] while working with cd .[tab]

Would you please add your (or my) little script to the documentation under special-dirs? :)




To find out that `Z/..' is not the same directory as `.' requires a bit
of extra work, which I don't have time to do just now, but you can see
how you'd just insert that into the conditions under which the reply
array is set by the style.

I dont use CHASE_DOTS luckely :)


http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net


--
Dennis
use Inline C => qq{void p(char*g){printf("Just Another %s Hacker\n",g);}};p("Perl");





Messages sorted by: Reverse Date, Date, Thread, Author