Skip to content

Commit 32b59ce

Browse files
committed
Add "fillexceeding" option for max line indicator
The "exceeding" indicator can be hard to notice as it fills just one column on lines that exceed the max line length. To address this, add a new indicator option "fillexceeding", which fills all the columns that exceed the max length.
1 parent 30ddc05 commit 32b59ce

2 files changed

Lines changed: 28 additions & 15 deletions

File tree

doc/editorconfig.txt

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -124,25 +124,29 @@ is restarted.
124124

125125
*g:EditorConfig_max_line_indicator*
126126
The way to show the line where the maximal length is reached. Accepted values
127-
are "line", "fill" and "exceeding", otherwise there will be no max line
128-
indicator.
127+
are "line", "fill", "exceeding" and "fillexceeding", otherwise there will be
128+
no max line indicator.
129129

130-
"line": the right column of the max line length column will be
131-
highlighted, made possible by adding "+1" to 'colorcolumn'.
130+
"line": the right column of the max line length column will be
131+
highlighted, by adding "+1" to 'colorcolumn'.
132132

133-
"fill": all the columns to the right of the max line length column
134-
will be highlighted, made possible by setting 'colorcolumn'
135-
to a list of numbers starting from "max_line_length + 1" to
136-
the number of columns on the screen.
133+
"fill": all the columns to the right of the max line length column
134+
will be highlighted, by setting 'colorcolumn' to a list
135+
of numbers starting from "max_line_length + 1" to the
136+
number of columns on the screen.
137137

138-
"exceeding": the right column of the max line length column will be
139-
highlighted on lines that exceed the max line length, made
140-
possible by adding a match for the ColorColumn group.
138+
"exceeding": the right column of the max line length column will be
139+
highlighted on lines that exceed the max line length, by
140+
adding a match for the ColorColumn group.
141141

142-
"none": no max line length indicator will be shown. This is the
143-
recommended value when you do not want any indicator to be
144-
shown, but values other than "line" or "fill" would also work
145-
as "none".
142+
"fillexceeding" : all the columns to the right of the max line length column
143+
will be highlighted on lines that exceed the max line
144+
length, by adding a match for the ColorColumn group.
145+
146+
"none": no max line length indicator will be shown. This is the
147+
recommended value when you do not want any indicator to
148+
be shown, but values other than "line" or "fill" would
149+
also work as "none".
146150

147151
To set this option, add any of the following lines to your |vimrc| file:
148152
>

plugin/editorconfig.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,15 @@ function! s:ApplyConfig(config) abort " Set the buffer options {{{1
502502
endfor
503503
call matchadd('ColorColumn',
504504
\ '\%' . (l:max_line_length + 1) . 'v.', 100)
505+
elseif g:EditorConfig_max_line_indicator == 'fillexceeding'
506+
let &l:colorcolumn = ''
507+
for l:match in getmatches()
508+
if get(l:match, 'group', '') == 'ColorColumn'
509+
call matchdelete(get(l:match, 'id'))
510+
endif
511+
endfor
512+
call matchadd('ColorColumn',
513+
\ '\%'. (l:max_line_length + 1) . 'v.\+', -1)
505514
endif
506515
endif
507516
endif

0 commit comments

Comments
 (0)