Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh completion with _files
- X-seq: zsh-users 19218
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Cornelius Kölbel <cornelius.koelbel@xxxxxxxxxxxxx>
- Subject: Re: zsh completion with _files
- Date: Tue, 07 Oct 2014 18:02:44 +0200
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1412697766; bh=TIOKezkX5bI5sT65oKYeJgQsbFqI9MMjgOUngSO/mm0=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:cc:In-reply-to:From:References:To:Subject:MIME-Version:Content-Type:Content-ID:Content-Transfer-Encoding:Date:Message-ID; b=YD+tXvJ6ONV4cdJt64GHOkR7bLpqbzELi1QqMArTAogexKJkka+LWOVisZVCkV2IktAiWgJbCdCC3//eLRQjotVfY5+EeOTruGdowacj+nTNsM2Lj1nUGPUNq9Ih31oA6ZEiuf17qO5cHdj0djou3hlJJTFto8XgIjV0fieHo64=
- In-reply-to: <54340A39.8050701@netknights.it>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <54340A39.8050701@netknights.it>
Cornelius Kölbel wrote:
>
> I used tests for the previous and the pre-previous word like
> $words[$#words-1 or 2] .
That might not be want you want if the cursor is in the middle of the
line rather than at the end. You might want $words[CURRENT] or
$words[CURRENT-1], etc.
> I realized that it might work this way:
>
> local curr=$words[$#words]
>
> case $curr in
> @*)
> _files
> ;;
> esac
> But then it is looking for files starting with @.
You need to move the @ character from the PREFIX to the IPREFIX
variable. There's a shortcut for this using the compset command:
if compset -P '@'; then
_files
else
...
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author