File tree 3 files changed +29
-1
lines changed
3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,13 @@ _requested $tag ||
33
33
34
34
typeset -g _autocomplete__unambiguous="$compstate[unambiguous]"
35
35
36
- builtin compadd -J "$tag" -x $'%{\e[0;2m%}%Bcommon substring:%b %F{0}%K{11}'"$compstate[unambiguous]%f%k"
36
+ # Retrieve highlight value.
37
+ local format
38
+ zstyle -s ":completion:${curcontext}:unambiguous" format format ||
39
+ format=$'%{\e[0;2m%}%Bcommon substring:%b %0F%11K%d%f%k'
40
+
41
+ zformat -F format "$format" "d:$compstate[unambiguous]"
42
+
43
+ builtin compadd -J "$tag" -x "$format"
37
44
38
45
false
Original file line number Diff line number Diff line change @@ -162,6 +162,9 @@ builtin zstyle ':completion:*:default' select-prompt '%F{black}%K{12}line %l %p%
162
162
builtin zstyle ' :completion:*' insert-sections yes
163
163
builtin zstyle ' :completion:*' separate-sections yes
164
164
165
+ builtin zstyle ' :autocomplete:*' common-substring-highlight ' %F{0}%K{11}'
166
+
167
+
165
168
# Needed for _gnu_generic to prevent descriptions from getting cropped.
166
169
is-at-least 5.9 ||
167
170
builtin zstyle ' :completion:*' command ' - COLUMNS=999'
Original file line number Diff line number Diff line change @@ -194,6 +194,24 @@ zstyle ':completion:*:*' matcher-list 'm:{[:lower:]-}={[:upper:]_}' '+r:|[.]=**'
194
194
Note, though, that this will also slightly change what completions are listed initially. This is a
195
195
limitation of the underlying implementation in Zsh.
196
196
197
+ ### Customize common substring message
198
+ You can customize the way the common substring is presented. The following sets the presentation to
199
+ the default:
200
+ ``` zsh
201
+ builtin zstyle ' :autocomplete:*:unambiguous' format \
202
+ $' %{\e [0;2m%}%Bcommon substring:%b %0F%11K%d%f%k'
203
+ ```
204
+ ` %d ` will be replaced with the common substring. Additionally, the following [ Zsh prompt escape
205
+ sequences] ( https://zsh.sourceforge.io/Doc/Release/Prompt-Expansion.html#Visual-effects ) are
206
+ supported for adding visual effects:
207
+ * ` %B ` : bold
208
+ * ` %F ` : foreground color
209
+ * ` %K ` : background color
210
+ * ` %S ` : ` terminfo ` "standout"
211
+ * ` %U ` : underline
212
+ * ` %{...%} ` : arbitrary [ ANSI escape
213
+ sequence] ( https://en.wikipedia.org/wiki/ANSI_escape_code#Select_Graphic_Rendition_parameters )
214
+
197
215
### Make <kbd >Enter</kbd > submit the command line straight from the menu
198
216
By default, pressing <kbd >Enter</kbd > in the menu search exits the search and
199
217
pressing it otherwise in the menu exits the menu. If you instead want to make
You can’t perform that action at this time.
0 commit comments