Skip to content

Commit ee6e91c

Browse files
authored
Merge pull request #203 from mmrwoods/master
Add "fillexceeding" option for max line indicator
2 parents ed23a49 + f0fa8c3 commit ee6e91c

2 files changed

Lines changed: 27 additions & 15 deletions

File tree

doc/editorconfig.txt

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -124,25 +124,28 @@ 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 on all lines, 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
134+
column will be highlighted on all lines, by setting
135+
'colorcolumn' to a list starting from "max_line_length +
136+
1" to the 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
143+
column will be highlighted on lines that exceed the max
144+
line length, by adding a match for the ColorColumn group.
145+
146+
"none": no max line length indicator will be shown. Recommended
147+
when you do not want any indicator to be shown, but any
148+
value other than those listed above also work as "none".
146149

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

plugin/editorconfig.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,15 @@ function! s:ApplyConfig(config) abort " Set the buffer options {{{1
505505
endfor
506506
call matchadd('ColorColumn',
507507
\ '\%' . (l:max_line_length + 1) . 'v.', 100)
508+
elseif g:EditorConfig_max_line_indicator == 'fillexceeding'
509+
let &l:colorcolumn = ''
510+
for l:match in getmatches()
511+
if get(l:match, 'group', '') == 'ColorColumn'
512+
call matchdelete(get(l:match, 'id'))
513+
endif
514+
endfor
515+
call matchadd('ColorColumn',
516+
\ '\%'. (l:max_line_length + 1) . 'v.\+', -1)
508517
endif
509518
endif
510519
endif

0 commit comments

Comments
 (0)