23 KiB
Changes in HEAD
Changes fixed as part of the switch to zle-line-pre-redraw
The changes in this section were fixed by switching to a zle-line-pre-redraw
-based
implementation.
Note: The new implementation will only be used on future zsh releases,
numbered 5.8.0.3 and newer, due to interoperability issues with other plugins
(issues #418 and #579). The underlying zsh feature has been available since
zsh 5.2.
Whilst under development, the new implementation was known as the
"feature/redrawhook" topic branch.
-
Fixed: Highlighting not triggered after popping a buffer from the buffer stack
(using thepush-line
widget, default binding:M-q
)
[#40] -
Fixed: Invoking completion when there were no matches removed highlighting
[#90, #470] -
Fixed: Two successive deletes followed by a yank only yanked the latest
delete, rather than both of them
[#150, #151, #160; cf. #183] -
Presumed fixed: Completing
$(xsel)
results in an error message fromxsel
,
with pre-2017 versions ofxsel
. (For 2017 vintage and newer, see the issue
for details.)
[#154] -
Fixed: When the standard
bracketed-paste-magic
widget is in use, pastes were slow
[#295] -
Fixed: No way to prevent a widget from being wrapped
[#324] -
Fixed: No highlighting while cycling menu completion
[#375] -
Fixed: Does not coexist with the
IGNORE_EOF
option
[#377] -
Fixed: The
undefined-key
widget was wrapped
[#421] -
Fixed: Does not coexist with the standard
surround
family of widgets
[#520] -
Fixed: First completed filename doesn't get
path
highlighting
[#632]
Other changes
- Add issue #712 to the previous release's changelog (hereinafter).
Changes in 0.8.0-alpha1-pre-redrawhook
Notice about an improbable-but-not-impossible forward incompatibility
Everyone can probably skip this section.
The master
branch of zsh-syntax-highlighting uses a zsh feature that has not
yet appeared in a zsh release: the memo=
feature, added to zsh in commit
zsh-5.8-172-gdd6e702ee (after zsh 5.8, before zsh 5.9). In the unlikely event
that this zsh feature should change in an incompatible way before the next
stable zsh release, set zsh_highlight__memo_feature=0
in your .zshrc files to
disable use of the new feature.
z-sy-h dogfoods the new, unreleased zsh feature because that feature was
added to zsh at z-sy-h's initiative. The new feature is used in the fix
to issue #418.
Incompatible changes:
-
An unsuccessful completion (a ⮀ Tab press that doesn't change the
command line) no longer causes highlighting to be lost. Visual feedback can
alternatively be achieved by setting theformat
zstyle under thewarnings
tag, for example,zstyle ':completion:*:warnings' format '%F{red}No matches%f'
Refer to the [description of the
format
style inzshcompsys(1)
]
zshcompsys-Standard-Styles-format.(#90, part of #245 (feature/redrawhook))
Other changes:
-
Document
$ZSH_HIGHLIGHT_MAXLENGTH
.
[#698] -
Optimize highlighting unquoted words (words that are not in single quotes, double quotes, backticks, or dollar-single-quotes)
[#730] -
Redirection operators (e.g.,
<
and>
) are now highlighted by default
[#646] -
Propertly terminate
noglob
scope in try/always blocks
[#577] -
Don't error out when
KSH_ARRAYS
is set in the calling scope
[#622, #689] -
Literal semicolons in array assignments (
foo=( bar ; baz )
) are now
highlighted as errors.
[3ca93f864f
] -
Command separators in array assignments (
foo=( bar | baz )
) are now
highlighted as errors.
[#651,81267ca313
] -
Support parameter elision in command position (e.g.,
$foo ls
where$foo
is unset or empty)
[#667] -
Don't consider the filename in
sudo -e /path/to/file
to be a command position
[#678] -
Don't look up absolute directory names in $cdpath
[2cc2583f8f
, part of #669] -
Fix
exec 2>&1;
being highlighted as an error.
[#676] -
Fix
: $(<*)
being highlighted as globbing.
[#582] -
Fix
cat < *
being highlighting as globbing when theMULTIOS
option is unset.
[#583] -
Fix
echo >&2
highlighting the2
as a filename if a file by that name happened to exist
[#694, part of #645] -
Fix
echo >&-
highlighting the-
as a filename if a file by that name happened to exist
[part of #645] -
Fix
echo >&p
highlighting thep
as a filename if a file by that name happened to exist
[part of #645] -
Fix wrong highlighting of unquoted parameter expansions under zsh 5.2 and older
[e165f18c75
] -
Highlight global aliases
[#700] -
Highlight
: =nosuchcommand' as an error (when the
EQUALS` option hasn't been unset).
[#430] -
Highlight reserved word after assignments as errors (e.g.,
foo=bar (ls;)
)
[#461] -
Correctly highlight
[[ foo && bar || baz ]]
. -
Highlight non-executable files in command position correctly (e.g.,
% /etc/passwd
)
[#202, #669] -
Highlight directories in command position correctly, including
AUTO_CD
support
[#669] -
Recognize
env
as a precommand (e.g.,env FOO=bar ls
) -
Recognize
strace
as a precommand -
Fix an error message on stderr before every prompt when the
WARN_NESTED_VAR
zsh option is set:
_zsh_highlight_main__precmd_hook:1: array parameter _zsh_highlight_main__command_type_cache set in enclosing scope in function _zsh_highlight_main__precmd_hook
[#727, #731, #732, #733] -
Fix highlighting of alias whose definitions use a simple command terminator
(such as;
,|
,&&
) before a newline
[#677; had regressed in 0.7.0] -
Highlight arithmetic expansions (e.g.,
$(( 42 ))
)
[#607 #649 #704] -
Highlight the parentheses of array assignments as reserved words (
foo=( bar )
).
Theassign
style remains supported and has precedence.
[#585] -
Fix interoperability issue with other plugins that use highlighting. The fix
requires zsh 5.8.0.3 or newer. (zsh 5.8.0.2-dev from themaster
branch,
revision zsh-5.8-172-gdd6e702ee or newer is also fine.)
[#418, https://github.com/okapia/zsh-viexchange/issues/1] -
Improve performance of the
brackets
highlighter. -
Fix highlighting of pre-command redirections (e.g., the
$fn
in<$fn cat
)
[#712]
Changes in version 0.7.1
- Remove out-of-date information from the 0.7.0 changelog.
Changes in version 0.7.0
This is a stable bugfix and feature release. Major new features and changes include:
-
Add
ZSH_HIGHLIGHT_DIRS_BLACKLIST
to disable "path" and "path prefix"
highlighting for specific directories
[#379] -
Add the "regexp" highlighter, modelled after the pattern highlighter
[4e6f60063f
] -
When a word uses globbing, only the globbing metacharacters will be highlighted as globbing:
in: foo*bar
, only the*
will be blue.
[e48af35753
] -
Highlight pasted quotes (e.g.,
: foo"bar"
)
[dc1b2f6fa4
] -
Highlight command substitutions (
: `ls`
,: $(ls)
)
[c0e64fe131
and parents,e86f75a840
, et al] -
Highlight process substitutions (
: >(nl)
,: <(pwd)
,: =(git diff)
)
[c0e64fe131
and parents,e86f75a840
, et al] -
Highlight command substitutions inside double quotes (
: "`foo`"
)
[f16e858f0c
] -
Highlight many precommands (e.g.,
nice
,stdbuf
,eatmydata
;
see$precommand_options
in the source) -
Highlight numeric globs (e.g.,
echo /lib<->
) -
Assorted improvements to aliases highlighting
(e.g.,
alias sudo_u='sudo -u'; sudo_u jrandom ls
,
alias x=y y=z z=nosuchcommand; x
,
alias ls='ls -l'; \ls
)
[f3410c5862
,57386f30ae
, #544, and many others] -
Highlight some more syntax errors
[dea05e44e6
,298ef6a2fa
] -
New styles: named file descriptors,
RC_QUOTES
, and unclosed quotes (e.g.,echo "foo<CURSOR>
)
[38c794a978
,25ae1c0121
, 967335dfc5fd] -
The 'brackets' highlighting no longer treats quotes specially.
[ecdda36ef5
]
Selected bugfixes include:
-
Highlight
sudo
correctly when it's not installed
[26a82113b0
] -
Handle some non-default options being set in zshrc
[b07ada1255
,a2a899b41b
,972ad197c1
,b3f66fc874
] -
Fix off-by-one highlighting in vi "visual" mode (vicmd keymap)
[be3882aeb0
] -
The 'yank-pop' widget is not wrapped
[#183]
Known issues include:
- A multiline alias that uses a simple command terminator (such as
;
,|
,&&
)
before a newline will incorrectly be highlighted as an error. See issue #677
for examples and workarounds.
[#677]
[UPDATE: Fixed in 0.8.0]
Changes in version 0.6.0
This is a stable release, featuring bugfixes and minor improvements.
Performance improvements:
(none)
Added highlighting of:
- The
isearch
andsuffix
$zle_highlight
settings.
(79e4d3d124
,15db71abd0
, b56ee542d619; requires zsh 5.3 for$ISEARCHMATCH_ACTIVE
/$SUFFIX_ACTIVE
support)
-
Possible history expansions in double-quoted strings.
(76ea9e1df3
) -
Mismatched
if
/then
/elif
/else
/fi
.
(73cb832702
)
Fixed highlighting of:
-
A comment line followed by a non-comment line.
(#385,9396ad5c5f
) -
An unquoted
$*
(expands to the positional parameters).
(237f89ad62
) -
history-incremental-pattern-search-backward under zsh 5.3.1.
(#407, #415,462779629a
)
API changes (for highlighter authors):
(none)
Developer-visible changes:
- tests: Set the
ALIAS_FUNC_DEF
option for zsh 5.4 compatibility.
(9523d6d49c
)
Other changes:
-
docs: Added before/after screenshots.
(cd9ec14a65ec..b7e277106b49) -
docs: Link Fedora package.
(3d74aa47e4
,5feed23962
) -
docs: Link FreeBSD port.
(626c034c68
) -
docs: Link OpenSUSE Build Service packages
(#419,dea1fedc73
) -
Prevent user-defined aliases from taking effect in z-sy-h's own code.
(#390,2dce602727
, 8d5afe47f774; and #392, #395,b8fa1b9dc9
) -
docs: Update zplug installation instructions.
(#399,4f49c4a35f
) -
Improve "unhandled ZLE widget 'foo'" error message.
(#409,be083d7f37
) -
Fix printing of "failed loading highlighters" error message.
(#426,ad522a0914
)
Changes in version 0.5.0
Performance improvements:
We thank Sebastian Gniazdowski and "m0viefreak" for significant contributions
in this area.
-
Optimize string operations in the
main
(default) highlighter.
(#372/3cb58fd7d7b9,02229ebd63
,ef4bfe5bcc
, #372/c6b6513ac0d6, #374/15461e7d21c3) -
Command word highlighting: Use the
zsh/parameter
module to avoid forks.
Memoize (cache) the results.
(#298,3ce01076b5
,2f18ba64e3
, 12b879caf7a6; #320,3b67e656bf
) -
Avoid forks in the driver and in the
root
highlighter.
(b9112aec79
,38c8fbea2d
)
Added highlighting of:
-
pkexec
(a precommand).
(#248,4f3910cbba
) -
Aliases that cannot be defined normally nor invoked normally (highlighted as an error).
(#263 (in part),28932316cc
) -
Path separators (
/
) — the default behaviour remains to highlight path separators
and path components the same way.
(#136, #260,6cd39e7c70
,9a934d291e
,f3d3aaa00c
) -
Assignments to individual positional arguments (
42=foo
to assign to$42
).
(f4036a09ce
) -
Linewise region (the
visual-line-mode
widget, bound toV
in zsh'svi
keymap).
(#267,a7a7f8b422
,ee07588cfd
) -
Command-lines recalled by
isearch
mode; requires zsh≥5.3.
(#261 (in part); #257;4ad311ec0a
) -
Command-lines whilst the
IGNORE_BRACES
orIGNORE_CLOSE_BRACES
option is in effect.
(a8a6384356
,02807f1826
) -
Mismatched parentheses and braces (in the
main
highlighter).
(51b9d79c3b
,2fabf7ca64
,a4196eda5e
, and others) -
Mismatched
do
/done
keywords.
(b2733a64da
) -
Mismatched
foreach
/end
keywords.
(#96,2bb8f0703d
) -
In Bourne-style function definitions, when the
MULTI_FUNC_DEF
option is set
(which is the default), highlight the first word in the function body as
a command word:f() { g "$@" }
.
(6f91850a01
) -
always
blocks.
(#335,e5782e4ddf
) -
Command substitutions inside double quotes,
"$(echo foo)"
.
(#139 (in part),c3913e0d8e
) -
Non-alphabetic parameters inside double quotes (
"$$"
,"$#"
,"$*"
,"$@"
,"$?"
,"$-"
).
(4afe670f7a
,44ef6e38e5
) -
Command words from future versions of zsh (forward compatibly).
This also adds anarg0
style that all other command word styles fall back to.
(b4537a972e
,bccc3dc269
) -
Escaped history expansions inside double quotes:
: "\!"
(28d7056a7a
, et seq)
Fixed highlighting of:
-
Command separator tokens in syntactically-invalid positions.
(09c4114eb9
) -
Redirections with a file descriptor number at command word.
(#238 (in part),73ee7c1f6c
) -
The
select
prompt,$PS3
.
(#268,451665cb2a
) -
Values of variables in
vared
.
(e500ca2462
) -
!
as an argument (neither a history expansion nor a reserved word).
(4c23a2fd1b
) -
"division by zero" error under the
brackets
highlighter when$ZSH_HIGHLIGHT_STYLES
is empty.
(f73f3d53d3
) -
Process substitutions,
<(pwd)
and>(wc -l)
.
(#302,6889ff6bd2
,bfabffbf97
,fc9c892a3f
) -
The non-
SHORT_LOOPS
form ofrepeat
loops:repeat 42; do true; done
.
(#290,4832f18c50
,ef68f50c04
,6362c757b6
) -
Broken symlinks (are now highlighted as files).
(#342,95f7206a93
,53083da821
) -
Lines accepted from
isearch
mode.
(#284; #257, #259, #288;5bae621900
,a8fe22d422
) -
Work around upstream bug that triggered when the command word was a relative
path, that when interpreted relative to a $PATH directory denoted a command;
the effect of that upstream bug was that the relative path was cached as
a "valid external command name".
(#354, #355,51614ca2c9
,fdaeec4514
, 7d38d07255e4;
upstream fix slated to be released in 5.3 (workers/39104)) -
After accepting a line with the cursor on a bracket, the matching bracket
of the bracket under the cursor no longer remains highlighted (with the
brackets
highlighter).
(4c4baede51
) -
The first word on a new line within an array assignment or initialization is no
longer considered a command position.
(8bf423d16d
) -
Subshells that end at command position,
(A=42)
,(true;)
.
(#231, 7fb6f9979121; #344,4fc35362ee
) -
Command word after array assignment,
a=(lorem ipsum) pwd
.
(#330,7fb6f99791
)
API changes (for highlighter authors):
-
New interface
_zsh_highlight_add_highlight
.
(341a3ae1f0
,c346f6eb6f
) -
tests: Specify the style key, not its value, in test expectations.
(a830613467
,fd061b5730
,eaa4335c34
, among others) -
Module author documentation improvements.
(#306 (in part),2176692704
,0ff354b44b
,80148f6c84
,364f206a54
, and others) -
The driver no longer defines a
_zsh_highlight_${highlighter}_highlighter_cache
variable, which is in the highlighters' namespace.
(3e59ab41b6
,80148f6c84
,f91a7b885e
) -
Rename highlighter entry points. The old names remain supported for
backwards compatibility.
(a3d5dfcbda
,c793e0dcea
) -
tests: Add the "NONE" expectation.
(4da9889d15
,13018f3dd7
,d37c55c788
) -
tests: consider a test that writes to stderr to have failed.
(#291,1082067f93
)
Developer-visible changes:
-
Add
make quiet-test
.
(9b64ad750f
) -
test harness: Better quote replaceables in error messages.
(30d8f92df2
) -
test harness: Fix exit code for XPASS.
(bb8d325c0c
) -
Create HACKING.md.
(cef49752fd
) -
tests: Emit a description for PASS test points.
(6aa57d60aa
,f0bae44b76
) -
tests: Create a script that generates a test file.
(8013dc3b8d
, et seq;tests/generate.zsh
)
Other changes:
-
Under zsh≤5.2, widgets whose names start with a
_
are no longer excluded
from highlighting.
(ed33d2cb1388; reverts part of186d80054a
which was for #65) -
Under zsh≤5.2, widgets implemented by a function named after the widget are
no longer excluded from highlighting.
(487b122c480d; reverts part of776453cb5b
) -
Under zsh≤5.2, shell-unsafe widget names can now be wrapped.
(#278,6a634fac9f
, et seq) -
Correct some test expectations.
(78290e043b
) -
zsh-syntax-highlighting.plugin.zsh
: Convert from symlink to plain file
for msys2 compatibility.
(#292,d4f8edc9f3
) -
Document installation under some plugin managers.
(e635f766be
,9cab566f53
) -
Don't leak the
PATH_DIRS
option.
(7b82b88a71
) -
Don't require the
FUNCTION_ARGZERO
option to be set.
(#338,750aebc553
) -
Under zsh≤5.2, support binding incomplete/nonexistent widgets.
(9e569bb0fe
, part of #288) -
Make the driver reentrant, fixing possibility of infinite recursion
under zsh≤5.2 under interaction with theoretical third-party code.
(#305,d711563fe1
,295d62ec88
,f3242cbd6a
) -
Fix warnings when
WARN_CREATE_GLOBAL
is set prior to sourcing zsh-syntax-highlighting.
(z-sy-h already setsWARN_CREATE_GLOBAL
internally.)
(da60234fb2
) -
Warn only once, rather than once per keypress, when a highlighter is unavailable.
(0a9b347483
)
Changes in version 0.4.1
Fixes:
- Arguments to widgets were not properly dash-escaped. Only matters for widgets
that take arguments (i.e., that are invoked aszle ${widget} -- ${args}
).
(282c7134e8
, revertsc808d2187a
)
Changes in version 0.4.0
Added highlighting of:
-
incomplete sudo commands
(a3047a9121
,2f05620b19
)sudo; sudo -u;
-
command words following reserved words
(#207, #222,b397b12ac1
et seq,6fbd2aa957
et seq,8b4adbd991
)if ls; then ls; else ls; fi repeat 10 do ls; done
(The
ls
are now highlighted as a command.) -
comments (when
INTERACTIVE_COMMENTS
is set)
(#163, #167,693de99a90
)echo Hello # comment
-
closing brackets of arithmetic expansion, subshells, and blocks
(#226,a59f442d2d
, et seq)(( foo )) ( foo ) { foo }
-
command names enabled by the
PATH_DIRS
option
(#228,96ee5116b1
)# When ~/bin/foo/bar exists, is executable, ~/bin is in $PATH, # and 'setopt PATH_DIRS' is in effect foo/bar
-
parameter expansions with braces inside double quotes
(#186,6e3720f39d
)echo "${foo}"
-
parameter expansions in command word
(#101,4fcfb15913
)x=/bin/ls $x -l
-
the command separators '|&', '&!', '&|'
view file.pdf &! ls
Fixed highlighting of:
-
precommand modifiers at non-command-word position
(#209,2c9f8c8c95
)ls command foo
-
sudo commands with infix redirections
(#221,be006aded5
,86e9249709
)sudo -u >/tmp/foo.out user ls
-
subshells; anonymous functions
(#166, #194,0d1bfbcbfa
,9e178f9f39
)(true) () { true }
-
parameter assignment statements with no command
(#205,01d7eeb3c7
)A=1;
(The semicolon used to be highlighted as a mistake)
-
cursor highlighter: Remove the cursor highlighting when accepting a line.
(#109,4f0c293fde
)
Removed features:
- Removed highlighting of approximate paths (
path_approx
).
(#187,98aee7f8b9
)
Other changes:
-
main highlighter refactored to use states rather than booleans.
(2080a441ac
, et seq) -
Fix initialization when sourcing
zsh-syntax-highlighting.zsh
via a symlink
(083c47b007
) -
docs: Add screenshot.
(57624bb9f6
) -
widgets wrapping: Don't add '--' when invoking widgets.
(c808d2187a
) [reverted in 0.4.1] -
Refresh highlighting upon
accept-*
widgets (accept-line
et al).
(59fbdda64c
) -
Stop leaking match/mbegin/mend to global scope (thanks to upstream
WARN_CREATE_GLOBAL
improvements).
(d3deffbf46
) -
'make install': Permit setting
$(SHARE_DIR)
from the environment.
(e1078a8b4c
) -
driver: Tolerate KSH_ARRAYS being set in the calling context.
(#162,8f19af6b31
) -
'make install': Install documentation fully and properly.
(#219,b1619c0013
, et seq) -
docs: Improve 'main' highlighter's documentation.
(00de155063
,7d4252f5f5
) -
docs: Moved to a new docs/ tree; assorted minor updates
(c575f8f375
,5b34c23cfa
, et seq) -
docs: Split README.md into INSTALL.md
(0b3183f6cb
) -
driver: Report
$ZSH_HIGHLIGHT_REVISION
when running from git
(84734ba950
)
Developer-visible changes:
-
Test harness converted to TAP format
(d99aa58aaa
, et seq) -
Run each test in a separate subprocess, isolating them from each other
(d99aa58aaa
, et seq) -
Fix test failure with nonexisting $HOME
(#216,b2ac98b981
) -
Test output is now colorized.
(4d3da30f8b
,6fe07c0961
) -
Document
make install
(a18a7427fd
) -
tests: Allow specifying the zsh binary to use.
(557bb7e0c6
) -
tests: Add 'make perf' target
(4513eaea71
) -
tests: Run each test in a sandbox directory
(c015339202
)
Changes in version 0.3.0
Added highlighting of:
-
suffix aliases (requires zsh 5.1.1 or newer):
alias -s png=display foo.png
-
prefix redirections:
<foo.txt cat
-
redirection operators:
echo > foo.txt
-
arithmetic evaluations:
(( 42 ))
-
$'' strings, including \x/\octal/\u/\U escapes
: $'foo\u0040bar'
-
multiline strings:
% echo "line 1 line 2"
-
string literals that haven't been finished:
% echo "Hello, world
-
command words that involve tilde expansion:
% ~/bin/foo
Fixed highlighting of:
-
quoted command words:
% \ls
-
backslash escapes in "" strings:
% echo "\x41"
-
noglob after command separator:
% :; noglob echo *
-
glob after command separator, when the first command starts with 'noglob':
% noglob true; echo *
-
the region (vi visual mode / set-mark-command) (issue #165)
-
redirection and command separators that would be highlighted as
path_approx
% echo foo;‸ % echo <‸
(where
‸
represents the cursor location) -
escaped globbing (outside quotes)
% echo \*
Other changes:
-
implemented compatibility with zsh's paste highlighting (issue #175)
-
$?
propagated correctly to wrapped widgets -
don't leak $REPLY into global scope
Developer-visible changes:
-
added makefile with
install
andtest
targets -
set
warn_create_global
internally -
document release process
Version 0.2.1
(Start of changelog.)