Skip to content

Commit 5123c53

Browse files
kmoschcaucxw42
authored andcommitted
Change line colorcolumn setting to not overwrite
This changes the modification of the 'colorcolumn' setting to not be overwritten, but instead expanded when g:EditorConfig_max_line_indicator is set to "line". This will preserve the previously set value. Also instead of calculating the column ourselves, we let Vim do it, by adding "+1" to the colorcolumn setting.
1 parent d354117 commit 5123c53

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

doc/editorconfig.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ 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", otherwise there will be no max line indicator.
127+
are "line", "fill" and "exceeding", otherwise there will be no max line
128+
indicator.
128129

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

133133
"fill": all the columns to the right of the max line length column
134134
will be highlighted, made possible by setting 'colorcolumn'

plugin/editorconfig.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ function! s:ApplyConfig(config) abort " Set the buffer options {{{1
473473
if exists('+colorcolumn')
474474
if l:max_line_length > 0
475475
if g:EditorConfig_max_line_indicator == 'line'
476-
let &l:colorcolumn = l:max_line_length + 1
476+
setlocal colorcolumn+=+1
477477
elseif g:EditorConfig_max_line_indicator == 'fill' &&
478478
\ l:max_line_length < &l:columns
479479
" Fill only if the columns of screen is large enough

0 commit comments

Comments
 (0)