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

https://discordapp.com/channels/732504251980578826/735225561240174693/763021897377775616
master
Jonathan Hodgson 4 years ago
parent 9479b9574e
commit 9ba7608e66
  1. 8
      nvim/.config/nvim/autoload/mine/functions.vim
  2. 5
      nvim/.config/nvim/plugin/settings.vim

@ -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…
Cancel
Save