Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: X=`cat ~/y` completion
- X-seq: zsh-users 21609
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: X=`cat ~/y` completion
- Date: Fri, 3 Jun 2016 12:29:05 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=7sYUn92W9GihBqK4YDloqePz30L0wamtbLl6fcdPTRQ=; b=rkQL2ztce/F+ptTZOo892d0pjRhgubADDqmUTc4qvoycO0i2WTj4rtXr22j+LPIOLf bGiF1ECrdibQDyAFONM6d0oChIonPNI45T8BXSRmCcT3MMibdrMHFsdWlYVT+qmsXN4v c0LIqWJn44klheUh2DrxOk36Ny4n86iy26wLC7+2zzt1xrr/brfkCMoMxfweOTnifpR5 4OGcgWBw9nvykXM8yKs16FF6/FkJuLq5tKMNtW+NJxW0XdW3F2vo611NsCpncZ5t+vM+ SlC3cKWxL/9t5RrEM1OvAn7ffeocojn4ZrQ64Tj80D+upG/glD+YeC4TNktrlPoSuN9w 0H4g==
- In-reply-to: <20160603053123.GA26773@fujitsu.shahaf.local2>
- 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: <20160603053123.GA26773@fujitsu.shahaf.local2>
[This is more properly a -workers discussion but I'll continue on -users
because we started here.]
On Jun 3, 5:31am, Daniel Shahaf wrote:
} Subject: X=`cat ~/y` completion
}
} Consider the following two cases:
}
} % X=`cat $HOME/t<TAB>
} % X=`cat ~/t<TAB>
}
} In 'zsh -f' + compinit, the former works but the latter doesn't.
} I expect the latter to behave as the former does.
}
} ---
}
} The last related discussion seems to be 35515/35539.
I don't think those are related, completing after ~/ works elsewhere.
The real difficulty seems to follow from testing $compstate[quote] on
line 276:
} 276 elif [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then
} 277
} 278 # It begins with `~', so [...]
The word on line does begin with tilde, but that's ignored because it is
inside the backticks.
The test could be either != [\'\"] or = (|\`) but I went with the latter
because the former confuses vim syntax highlighting.
diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files
index c64ebf5..14c4cc7 100644
--- a/Completion/Unix/Type/_path_files
+++ b/Completion/Unix/Type/_path_files
@@ -273,7 +273,7 @@ if [[ "$pre" = [^][*?#^\|\<\>\\]#(\`[^\`]#\`|\$)*/* && "$compstate[quote]" != \'
orig="${orig[1,(in:i:)/][1,-2]}"
donepath=
prepaths=( '' )
-elif [[ "$pre[1]" = \~ && -z "$compstate[quote]" ]]; then
+elif [[ "$pre[1]" = \~ && "$compstate[quote]" = (|\`) ]]; then
# It begins with `~', so remember anything before the first slash to be able
# to report it to the completion code. Also get an expanded version of it
Messages sorted by:
Reverse Date,
Date,
Thread,
Author