More options to highlight path component
This commit is contained in:
parent
d511fa39fa
commit
b127a06e6f
@ -36,7 +36,7 @@ according to that style (following `LS_COLORS`):
|
||||
* `sg` - files that have the sgid bit set
|
||||
* `ow` - files that are world-writable
|
||||
* `tw` - files that are world-writable and sticky
|
||||
* `lp` - if set, the path-component of a filename is highlighted using this style
|
||||
* `lp` - if set, the path component of a filename is highlighted using this style, unless it is set to `same`, in which case the path component is highlighted the same as the file
|
||||
|
||||
If a file would be highlighted `fi`, then it can be highlighted according to the
|
||||
filename using `ZSH_HIGHLIGHT_FILE_PATTERNS` instead. This array has the form
|
||||
|
@ -219,10 +219,19 @@ _zsh_highlight_highlighter_files_paint()
|
||||
fi
|
||||
|
||||
if [[ -n "$col" ]]; then
|
||||
if (( end > start + $#basename && ${+ZSH_HIGHLIGHT_FILE_TYPES[lp]} )); then
|
||||
region_highlight+=("$start $(( end - $#basename )) $ZSH_HIGHLIGHT_FILE_TYPES[lp]")
|
||||
if (( end > start + $#basename )); then
|
||||
# There is a path component
|
||||
if [[ $ZSH_HIGHLIGHT_FILE_TYPES[lp] = "same" ]]; then
|
||||
region_highlight+=("$start $end $col")
|
||||
else
|
||||
if (( ${+ZSH_HIGHLIGHT_FILE_TYPES[lp]} )); then
|
||||
region_highlight+=("$start $(( end - $#basename )) $ZSH_HIGHLIGHT_FILE_TYPES[lp]")
|
||||
fi
|
||||
region_highlight+=("$(( end - $#basename )) $end $col")
|
||||
fi
|
||||
else
|
||||
region_highlight+=("$start $end $col")
|
||||
fi
|
||||
region_highlight+=("$(( end - $#basename )) $end $col")
|
||||
fi
|
||||
|
||||
start=$end
|
||||
|
Loading…
Reference in New Issue
Block a user