Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Add completion suffix highlighting
- X-seq: zsh-workers 27466
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: Add completion suffix highlighting
- Date: Sat, 5 Dec 2009 19:31:41 +0000
- In-reply-to: <237967ef0912041353g2ff47fa8m9dd274ed8b37511@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <237967ef0912041353g2ff47fa8m9dd274ed8b37511@xxxxxxxxxxxxxx>
On Fri, 4 Dec 2009 22:53:58 +0100
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> I have a friend who just started using zsh a while ago, and she
> complained about / being removed when she pressed enter after
> completing a directory to rsync. Apparently rsync behaves differently
> with and without the / in place. We tried setting
> ZLE_REMOVE_SUFFIX_CHARS to nothing and using zle auto-suffix-retain in
> an accept-line hook, but then we realized it would be better if you
> could tell more easily if the suffix would be removed or not. So I
> whipped this up and somehow it worked on the first try (no guarantees
> though :). Given my poor track record of posting patches via email,
> here is a link to the patch, and I'll just paste in the essence of the
> patch for reference.
I'll commit this as it is with the following documentation and see
what happens---I think highlighting removable suffixes is actually quite
intuitive. Note, however, there are a lot of cases in which bold fonts
aren't supported.
Thanks.
Index: Doc/Zsh/zle.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/zle.yo,v
retrieving revision 1.80
diff -u -r1.80 zle.yo
--- Doc/Zsh/zle.yo 17 Apr 2009 15:26:46 -0000 1.80
+++ Doc/Zsh/zle.yo 5 Dec 2009 19:29:55 -0000
@@ -2163,6 +2163,17 @@
representation but are shown in a special manner by the line editor.
These characters are described below.
)
+cindex(completion removable suffix, highlighting)
+cindex(suffix, highlighting removable, in completion)
+cindex(removable suffix, highlighting in completino)
+item(tt(suffix)))(
+This context is used in completion for characters that are
+marked as suffixes that will be removed if the completion ends
+at that point, the most obvious example being a slash (tt(/)) after
+a directory name. Note that suffix removal is configurable; the
+circumstances under which the suffix will be removed may differ
+for different completions.
+)
enditem()
tt(zle_highlight) may contain additional fields for controlling how
@@ -2235,6 +2246,7 @@
)
item(tt(bold))(
The characters in the given context are shown in a bold font.
+Not all terminals distinguish bold fonts.
)
item(tt(standout))(
The characters in the given context are shown in the terminal's standout
@@ -2280,7 +2292,7 @@
context, the defaults applied are equivalent to
example(zle_highlight=LPAR()region:standout special:standout
-isearch:underline+RPAR())
+suffix:bold isearch:underline+RPAR())
i.e. both the region and special characters are shown in standout mode.
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author