Skip to content

Instantly share code, notes, and snippets.

@trapd00r
Created April 29, 2022 15:31
Show Gist options
  • Save trapd00r/d2399ae49059a8da138b2c3ef203192f to your computer and use it in GitHub Desktop.
Save trapd00r/d2399ae49059a8da138b2c3ef203192f to your computer and use it in GitHub Desktop.
" display a visual aid when lining long things up
" disable colorcolumn entirely if
" - cursor is in the first column
" - cursor is in the same column that &colorcolumn is set to
function! ColorColumnAtCursorPositionToggle()
let column = col('.')
if exists(&colorcolumn) || column == 1 || column == &colorcolumn
set colorcolumn&
else
let &colorcolumn = column
echohl ModeMsg
echo 'Colorcolumn set at column ' . column
echohl None
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment