Skip to content
Permalink
Browse files

Fix parsing of highlight with small windows

If there are insufficient columns to list all attributes of a highlight
group on one line the output will split the output over multiple lines.
This happens not only interactively but also when we call highlight with
execute() or capture the output with redir. In such circumstances the
remaining attributes that extend past the newline are indented with
leading spaces such that they are visually aligned with the attributes
on the prior line.

This accounts for such a possibility and ensures that the full contents
of a highlight group is on a single line.
  • Loading branch information
george-b committed Mar 3, 2019
1 parent 9eee2a6 commit a0ab9b9a64dfec4cae46a0f1b2cd5669994fd3df
Showing with 3 additions and 1 deletion.
  1. +3 −1 autoload/zenchrome.vim
@@ -1,6 +1,8 @@
function! zenchrome#GetColors()
let colors = {}
for highlight in split(execute('highlight'), '\n')
" Ensure one highlight group per line
let highlights = substitute(execute('highlight'), '\n\s\+', ' ', 'g')
for highlight in split(highlights, '\n')
let attributes = {}
let group = split(highlight)[0]
let group_attributes = split(highlight)[2:]

0 comments on commit a0ab9b9

Please sign in to comment.
You can’t perform that action at this time.