Skip to content

Commit

Permalink
Highlight the region on top of syntax highlighting.
Browse files Browse the repository at this point in the history
Let $zle_highlight[region] override $region_highlight.
  • Loading branch information
danielshahaf committed Sep 8, 2015
1 parent 555e142 commit 0e31d6e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions zsh-syntax-highlighting.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,22 @@ _zsh_highlight()

done

# Re-apply zle_highlight settings
() {
if (( REGION_ACTIVE )) ; then
# zle_highlight[region] defaults to 'standout' if unspecified
local region="${${zle_highlight[(r)region:*]#region:}:-standout}"
integer start end
if (( MARK > CURSOR )) ; then
start=$CURSOR end=$MARK
else
start=$MARK end=$CURSOR
fi
region_highlight+=("$start $end $region")
fi
}


} always {
_ZSH_HIGHLIGHT_PRIOR_BUFFER=$BUFFER
_ZSH_HIGHLIGHT_PRIOR_CURSOR=$CURSOR
Expand Down

0 comments on commit 0e31d6e

Please sign in to comment.