aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload
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/autoload
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/autoload')
-rw-r--r--vim/autoload/gitcommit.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/vim/autoload/gitcommit.vim b/vim/autoload/gitcommit.vim
new file mode 100644
index 00000000..56b35ba6
--- /dev/null
+++ b/vim/autoload/gitcommit.vim
@@ -0,0 +1,20 @@
+" Choose the color column depending on non-comment line count
+function! gitcommit#CursorColumn() abort
+
+ " Last line number
+ let l:ll = line('$')
+
+ " If we can find a line after the first that isn't a comment, we're
+ " composing the message
+ if l:ll > 1
+ for l:li in range(2, l:ll)
+ if getline(l:li) !~# '^\s*#'
+ return '+1'
+ endif
+ endfor
+ endif
+
+ " Otherwise, we're still composing our subject
+ return '51'
+
+endfunction