From: Mikael Magnusson <mikachu@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: possibly useful zsh_directory_name implementation
Date: Fri, 11 Mar 2011 02:15:34 +0100 [thread overview]
Message-ID: <AANLkTinMrQkEmLPqit1bEWEbsXcG4=5kWz7sfdrS_SBt@mail.gmail.com> (raw)
In-Reply-To: <AANLkTin+cCxFRYtwZXGSUWyLjfe7NV-eDx1mcS9sSau0@mail.gmail.com>
On 11 March 2011 02:06, Mikael Magnusson <mikachu@gmail.com> wrote:
> function zsh_directory_name () {
> case $1 in
> n)
> case $2 in
> /*)
> reply=( /${(j:/:)${(s:/:)PWD}[1,(er)${2[2,-1]}]} )
> ;;
> .*)
> reply=( (../)##${2[2,-1]}([1]) )
> ;;
> esac
> ;;
> c)
> local types vals description
> types=( '.:children of parent directories' '/:pwd segment' )
> case $PREFIX in
> '')
> vals=( $types )
> _describe 'dynamic dir type' vals -V dynamic-dirs -o -S ''
> ;;
> .*)
> vals=( (../)##*~(../)##$PWD:t(/:t) )
> ;|
> /*)
> vals=( "${(@)${(s:/:)PWD}[1,-2]}" )
> ;|
> *)
> _wanted -V dynamic-dirs expl
> ${${types[(r)$PREFIX[1]*]}[3,-1]} compadd -P $PREFIX[1] -qQS / -d vals
> ${(q)^vals}\]
These three lines should be one line, silly email.
--
Mikael Magnusson
next prev parent reply other threads:[~2011-03-11 1:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-11 1:06 Mikael Magnusson
2011-03-11 1:15 ` Mikael Magnusson [this message]
2011-03-11 10:44 ` Peter Stephenson
2011-03-11 12:06 ` Mikael Magnusson
2011-03-11 12:17 ` Peter Stephenson
2011-03-11 12:32 ` Mikael Magnusson
2011-03-11 16:25 ` Peter Stephenson
2011-03-11 16:33 ` Peter Stephenson
2011-03-11 17:09 ` Mikael Magnusson
2011-03-11 18:24 ` Peter Stephenson
2011-03-11 17:44 ` Jérémie Roquet
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='AANLkTinMrQkEmLPqit1bEWEbsXcG4=5kWz7sfdrS_SBt@mail.gmail.com' \
--to=mikachu@gmail.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).