More options to highlight path component

This commit is contained in:
Joe Rabinoff 2020-02-17 17:05:15 -05:00
commit b127a06e6f
2 changed files with 13 additions and 4 deletions

View file

@ -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