aboutsummaryrefslogtreecommitdiff
path: root/vim/after/ftplugin/gitcommit.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-14 23:51:34 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-14 23:52:45 +1200
commit52a738b89278e15a4d22418c68e4a142d849bca3 (patch)
treed63d8f66c23ec5fc3207f6d0443c2b56af404606 /vim/after/ftplugin/gitcommit.vim
parentMerge branch 'release/v1.30.0' into develop (diff)
downloaddotfiles-52a738b89278e15a4d22418c68e4a142d849bca3.tar.gz
dotfiles-52a738b89278e15a4d22418c68e4a142d849bca3.zip
Adaptive 'colorcolumn' for gitcommit filetype
Diffstat (limited to 'vim/after/ftplugin/gitcommit.vim')
-rw-r--r--vim/after/ftplugin/gitcommit.vim10
1 files changed, 10 insertions, 0 deletions
diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim
index 4f57a407..d390fa3c 100644
--- a/vim/after/ftplugin/gitcommit.vim
+++ b/vim/after/ftplugin/gitcommit.vim
@@ -8,6 +8,16 @@ setlocal comments+=n:>
setlocal formatoptions+=coqr
let b:undo_ftplugin .= '|setlocal comments< formatoptions<'
+" Choose the color column depending on non-comment line count
+if exists('+cursorcolumn')
+ augroup gitcommit
+ autocmd CursorMoved,CursorMovedI <buffer>
+ \ let &l:colorcolumn = gitcommit#CursorColumn()
+ augroup END
+ let b:undo_ftplugin .= '|autocmd! gitcommit'
+ \ . '|augroup! gitcommit'
+endif
+
" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_gitcommit_maps')
finish