Skip to content

Instantly share code, notes, and snippets.

@mmisono
Created April 3, 2013 16:04
Show Gist options
  • Save mmisono/5302557 to your computer and use it in GitHub Desktop.
Save mmisono/5302557 to your computer and use it in GitHub Desktop.
augroup ColorColumn
autocmd!
augroup END
function! s:startChangeCC()
autocmd ColorColumn CursorMoved * call s:changeColorColumn()
autocmd ColorColumn CursorMovedI * call s:changeColorColumn()
endfunction
function! s:endChangeCC()
augroup ColorColumn
autocmd!
augroup END
setl cc=0
endfunction
function! s:changeColorColumn()
let width = winwidth(0)
let match_end = matchend(reltimestr(reltime()), '\d\+\.') + 1
let rand = reltimestr(reltime())[match_end : ] % (width + 1)
exe "setl cc=".rand
endfunction
command! StartChangeCC call s:startChangeCC()
command! EndChangeCC call s:endChangeCC()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment