Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: conditionally match part of file name to most recently modified file - take 2
- X-seq: zsh-users 11590
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxxxxx>
- Subject: Re: conditionally match part of file name to most recently modified file - take 2
- Date: Mon, 18 Jun 2007 17:18:19 -0700
- In-reply-to: <20070618214614.GA21852@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20070617211644.GA11636@xxxxxxxxxxxx> <20070618110948.3d8d739f@xxxxxxxxxxxxxx> <20070618214614.GA21852@xxxxxxxxxxxx>
On Jun 18, 11:46pm, Eric Smith wrote:
}
} I would like to have certain commands automatically run this function.
} This I currently do with the following:
} #compdef vim less sed perl ooffice ...
Well, *that* you don't do with the #compdef. What you do with the
compdef is arrange that a certain completer is run for all of those
functions when you press tab, which is not what you asked for. Which
do you actually want?
} Then I would like to type
} "ooffice foo"
}
} And the function would execute:
} ooffice foo
You can define multiple functions at once:
setopt function_argzero
function vim less sed perl ooffice ... {
set -- $1 ${${1:h}:-.}/*${1:t}*(Nom[1]) $1
[[ -f $1 ]] || shift
command $0 $1
}
Tweaks, such as not doing this when there's more than one argument,
are left as an excercise.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author