Skip to content

Instantly share code, notes, and snippets.

@nima
Last active August 29, 2015 13:56
Show Gist options
  • Save nima/9186086 to your computer and use it in GitHub Desktop.
Save nima/9186086 to your computer and use it in GitHub Desktop.
Warn after 80-characters, with a toggle switch
set colorcolumn=81,82,83,84
au! FileType gitcommit set colorcolumn=71,72,73,74
let s:color_column_old = 0
function! s:ToggleColorColumn()
if s:color_column_old == 0
let s:color_column_old = &colorcolumn
windo let &colorcolumn = 0
else
windo let &colorcolumn=s:color_column_old
let s:color_column_old = 0
endif
endfunction
". Map F11 to enable/disable
nnoremap <silent> <F11> :call <SID>ToggleColorColumn()<cr>
inoremap <silent> <F11> <ESC>:call <SID>ToggleColorColumn()<cr>a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment