Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: renaming styles (!) (was: Re: Style names)
- X-seq: zsh-workers 10508
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: renaming styles (!) (was: Re: Style names)
- Date: Wed, 5 Apr 2000 13:05:02 +0200 (MET DST)
- In-reply-to: Peter Stephenson's message of Tue, 04 Apr 2000 20:31:56 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Peter Stephenson wrote:
> ...
>
> The things that need doing are styles for files, in particular, things
> consequent on particular styles like the bindkey for _expand and
> completeinword for prefix, and in the long run maybe a way of setting
> options (which should be simpler than styles). In the even longer run
> maybe the handling of contexts could be more intelligent, but I don't even
> know how yet.
I was wondering, too...
> > - use ambiguous (or first-ambiguous?) for paths
> > - leave the list style as it is
> > - use file-sort (or sort-files; I'm thinking about file-patterns) for
> > files, leave the rest
> > - stop-keys for i-c-w (and change break to break-keys)
>
> This sounds pretty good.
So, the patch:
- renames the `cursor' style for pathnames to `ambiguous'
- renames the `sort' style for files to `file-sort'
- renames the `break' and `stop' styles for i-c-w to `*-keys'
Bye
Sven
Index: Completion/Builtins/_zstyle
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_zstyle,v
retrieving revision 1.2
diff -u -r1.2 _zstyle
--- Completion/Builtins/_zstyle 2000/04/01 20:43:43 1.2
+++ Completion/Builtins/_zstyle 2000/04/05 11:02:13
@@ -11,9 +11,10 @@
styles=(
accept-exact c:bool
add-space c:bool
+ ambiguous c:bool
arguments c:
auto-description c:
- break c:
+ break-keys c:
completer c:completer
completions c:
condition c:
@@ -22,6 +23,7 @@
domains c:
expand c:
file-patterns c:filepat
+ file-sort c:fsort
format c:
glob c:
group-name c:
@@ -58,6 +60,7 @@
special-dirs c:sdirs
squeeze-slashes c:bool
stop c:stop
+ stop-keys c:
subst-glob-only c:
substitute c:
tag-order c:tag
@@ -134,20 +137,18 @@
;;
cursor)
- if [[ "$words[2]" = *:completion:inc* ]]; then
- _wanted values expl 'cursor positioning' compadd complete key default
- elif [[ "$words[2]" = *:completion::* ]]; then
- _wanted values expl 'cursor positioning' compadd true false
- else
- _wanted values expl 'cursor positioning' \
- compadd complete key default true false
- fi
+ _wanted values expl 'cursor positioning' compadd complete key default
;;
completer)
_wanted values expl completer \
compadd _complete _approximate _correct _match \
_expand _list _menu _oldlist _next_tags
+ ;;
+
+ fsort)
+ _wanted values expl 'how to sort files' \
+ compadd name size links time date modification access inode change reverse
;;
user-host-port)
Index: Completion/Core/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_path_files,v
retrieving revision 1.4
diff -u -r1.4 _path_files
--- Completion/Core/_path_files 2000/04/03 11:32:59 1.4
+++ Completion/Core/_path_files 2000/04/05 11:02:13
@@ -86,7 +86,7 @@
mopts=( "$mopts[@]" "$expl[@]" )
fi
-if zstyle -s ":completion:${curcontext}:files" sort tmp1; then
+if zstyle -s ":completion:${curcontext}:files" file-sort tmp1; then
case "$tmp1" in
*size*) sort=oL;;
*links*) sort=ol;;
@@ -464,7 +464,7 @@
if [[ -n $menu || -z "$compstate[insert]" ]] ||
! zstyle -t ":completion:${curcontext}:paths" expand suffix; then
- (( tmp4 )) && zstyle -t ":completion:${curcontext}:paths" cursor &&
+ (( tmp4 )) && zstyle -t ":completion:${curcontext}:paths" ambiguous &&
compstate[to_end]=''
if [[ "$tmp3" = */* ]]; then
compadd -Qf "$mopts[@]" -p "$linepath$tmp2" -s "/${tmp3#*/}" \
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.6
diff -u -r1.6 compsys.yo
--- Doc/Zsh/compsys.yo 2000/04/04 11:29:38 1.6
+++ Doc/Zsh/compsys.yo 2000/04/05 11:02:14
@@ -643,7 +643,7 @@
)
kindex(paths, completion tag)
item(tt(paths))(
-used to look up the values of the tt(expand), tt(cursor) and
+used to look up the values of the tt(expand), tt(ambiguous) and
tt(special-dirs) styles
)
kindex(pids, completion tag)
@@ -760,6 +760,13 @@
This style is used by the tt(_prefix) completer to decide if a space
should be inserted before the suffix.
)
+kindex(ambiguous, completion style)
+item(tt(ambiguous))(
+This is used with the tt(paths) tag by the function
+generating filenames as matches to find out if the cursor should be left
+after the first ambiguous pathname component even when menucompletion
+is used.
+)
kindex(auto-description, completion style)
item(tt(auto-description))(
If set, this style's value will be used as the description for options which
@@ -769,8 +776,8 @@
it may be useful to set this style to something like `tt(specify: %d)'.
Note that this may not work for some commands.
)
-kindex(break, completion style)
-item(tt(break))(
+kindex(break-keys, completion style)
+item(tt(break-keys))(
This style is used by the tt(incremental-complete-word) widget (found
in the tt(Functions/Zle) directory of the distribution). Its value
should be a pattern and all keys matching this pattern will cause the
@@ -874,11 +881,6 @@
)
kindex(cursor, completion style)
item(tt(cursor))(
-This is used together with the tt(paths) tag by the function
-generating filenames as matches to find out if the cursor should be left
-after the first ambiguous pathname component even when menucompletion
-is used.
-
The tt(predict-on) widget uses this style to decide where to place the
cursor after completion has been tried. If it is set to tt(complete),
the cursor is left at the place where completion left it, but only if
@@ -970,6 +972,20 @@
tt(EXTENDED_GLOB) option is in effect, so the characters `tt(#)',
`tt(~)' and `tt(^)' have special meanings in the patterns.
)
+kindex(file-sort, completion style)
+item(tt(file-sort))(
+The completion function that generates filenames as possible matches
+uses this style with the tt(files) tag to determine in which order the
+names should be listed and completed when using menucompletion. The
+value may be one of tt(size) to sort them by the size of the file,
+tt(links) to sort them by the number of links to the file,
+tt(modification) (or tt(time) or tt(date)) to sort them by the last
+modification time, tt(access) to sort them by the last access time, or
+tt(inode) (or tt(change)) to sort them by the last inode change
+time. Any other value (or not setting this style at all) makes them be
+sorted alphabetically by name. If the value contains the string
+tt(reverse), sorting is done in decreasing order.
+)
kindex(format, completion style)
item(tt(format))(
If this is set for the tt(descriptions) tag, its value is used as a
@@ -1499,18 +1515,6 @@
keeping them in the order in which they appear in the history (from
youngest to oldest).
-The completion function that generates filenames as possible matches
-uses this style with the tt(files) tag to determine in which order the
-names should be listed and completed when using menucompletion. The
-value may be one of tt(size) to sort them by the size of the file,
-tt(links) to sort them by the number of links to the file,
-tt(modification) (or tt(time) or tt(date)) to sort them by the last
-modification time, tt(access) to sort them by the last access time, or
-tt(inode) (or tt(change)) to sort them by the last inode change
-time. Any other value (or not setting this style at all) makes them be
-sorted alphabetically by name. If the value contains the string
-tt(reverse), sorting is done in decreasing order.
-
This is also used by the tt(_expand) completer. Here, if it is set to
`true', the expansions generated will always be sorted. If it is set
to tt(menu), then the expansions are only sorted when they are offered
@@ -1535,9 +1539,11 @@
command will always insert matches as if menucompletion were started
and it will stop when the last match is inserted. If this style is set
to tt(verbose) a message will be displayed when the last match is reached.
-
-This style is also used by the tt(incremental-complete-word)
-widget. Here its value is used like the one for the tt(break)
+)
+kindex(stop-keys, completion style)
+item(tt(stop-keys))(
+This style is used by the tt(incremental-complete-word)
+widget. Its value is used like the one for the tt(break-keys)
style. But all keys matching the pattern given as its value will stop
incremental completion and will then execute their usual function.
)
@@ -2612,7 +2618,7 @@
`tt(-r)', and `tt(-R)' options from the tt(compadd) builtin.
Finally, the tt(_path_files) function uses the styles tt(expand),
-tt(cursor) and tt(special-dirs) with the tt(paths) tag.
+tt(ambiguous) and tt(special-dirs) with the tt(paths) tag.
)
findex(_parameters)
item(tt(_parameters))(
Index: Functions/Zle/incremental-complete-word
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Zle/incremental-complete-word,v
retrieving revision 1.3
diff -u -r1.3 incremental-complete-word
--- Functions/Zle/incremental-complete-word 2000/04/05 08:49:50 1.3
+++ Functions/Zle/incremental-complete-word 2000/04/05 11:02:15
@@ -25,8 +25,8 @@
zstyle -s ":completion:${curcontext}" prompt pmpt ||
pmpt='incremental (%c): %u%s %l'
- zstyle -s ":completion:${curcontext}" stop stop
- zstyle -s ":completion:${curcontext}" break brk
+ zstyle -s ":completion:${curcontext}" stop-keys stop
+ zstyle -s ":completion:${curcontext}" break-keys brk
if zstyle -t ":completion:${curcontext}" list; then
wid=list-choices
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author