zsh-syntax-highlighting/highlighters
Nikola Knezevic e8517244f7 main: Allow for "]" in shell aliases
PR #776 fixed an issue with complex aliases and expansion. However, this change
also introduced a problem with aliases which contain `]` (for example, commonly
seen on macOS: `alias ]=open`), due to using an associative array `seen_alias`,
indexed by the alias name. Due to `"$seen_alias[$arg]"`, it would fail when
`$arg` is expanded to anything containing `]`'. Thus, typing `] /` would result
in:

```
> ] /
(anon):unset:3: seen_alias[]]: invalid parameter name
```

This change fixes the issue by ensuring we properly access keys in the
associative array `seen_alias`.

Older versions of zsh have issues with map keys having special
characters, especially lacking ways to remove such keys. The
issue is described in detail in
https://unix.stackexchange.com/questions/626393/in-zsh-how-do-i-unset-an-arbitrary-associative-array-element.

This fix uses proposal from
[zsh-workers/43269](https://www.zsh.org/mla/workers/2018/msg01073.html),
discovered by Stephane Chazelas, that boils down to avoid removing keys
from the map, and reconstruct the map anew with some keys omitted.

Co-authored-by: @phy1729
2021-03-04 20:29:43 -06:00
..
brackets brackets: Optimize the character iteration 2020-07-14 20:19:40 +00:00
cursor *: Change highlighters' namespace. 2016-08-16 17:53:01 +00:00
line highlighters: Rename entry points. 2016-08-16 17:51:43 +00:00
main main: Allow for "]" in shell aliases 2021-03-04 20:29:43 -06:00
pattern Use the new, unreleased zsh 'memo=' feature to remove only our own entries from $region_highlight. 2020-07-14 00:32:36 +00:00
regexp Use the new, unreleased zsh 'memo=' feature to remove only our own entries from $region_highlight. 2020-07-14 00:32:36 +00:00
root highlighters: Rename entry points. 2016-08-16 17:51:43 +00:00
README.md docs: Followup to the recent docs branch: clean up some internal cross-references. 2015-11-27 04:07:02 +00:00

README.md

zsh-syntax-highlighting / highlighters

Navigate into the individual highlighters' documentation to see what styles ($ZSH_HIGHLIGHT_STYLES keys) each highlighter defines.

Refer to the documentation on highlighters for further information.