VIM: colour column on textwidth or if not set col 80
This had to be done in a FileType * autocmd so that it is done once file
type has been determined and textwidth is set, as suggested by tae on
discord
7630218973
This commit is contained in:
parent
9479b9574e
commit
9ba7608e66
2 changed files with 13 additions and 0 deletions
|
@ -10,3 +10,11 @@ function! mine#functions#text() abort
|
||||||
inoremap <buffer> ; ;<C-g>u
|
inoremap <buffer> ; ;<C-g>u
|
||||||
inoremap <buffer> ? ?<C-g>u
|
inoremap <buffer> ? ?<C-g>u
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! mine#functions#colorcols() abort
|
||||||
|
if &textwidth > 0
|
||||||
|
setlocal colorcolumn=+0
|
||||||
|
else
|
||||||
|
setlocal colorcolumn=80,100
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
|
@ -43,3 +43,8 @@ let g:netrw_browsex_viewer = "opout"
|
||||||
set formatoptions+=r
|
set formatoptions+=r
|
||||||
" Automatically insert comment leader after hitting o or O
|
" Automatically insert comment leader after hitting o or O
|
||||||
set formatoptions+=o
|
set formatoptions+=o
|
||||||
|
|
||||||
|
augroup colorcols
|
||||||
|
autocmd!
|
||||||
|
autocmd FileType,VimEnter,BufEnter * call mine#functions#colorcols()
|
||||||
|
augroup end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue