diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-23 10:11:44 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-23 10:11:44 +1200 |
commit | 09cc56ec7d075dcc53013821454f70c5db4b105c (patch) | |
tree | ca91fcc931b695c69266c2ed8446a4279496dd44 /vim | |
parent | Set gitconfig commit.verbose, clear commit.status (diff) | |
download | dotfiles-09cc56ec7d075dcc53013821454f70c5db4b105c.tar.gz dotfiles-09cc56ec7d075dcc53013821454f70c5db4b105c.zip |
Refactor Git commit cursor column with snip line
Diffstat (limited to 'vim')
-rw-r--r-- | vim/autoload/gitcommit.vim | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/vim/autoload/gitcommit.vim b/vim/autoload/gitcommit.vim index 56b35ba6..170cc2d0 100644 --- a/vim/autoload/gitcommit.vim +++ b/vim/autoload/gitcommit.vim @@ -1,18 +1,19 @@ " 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 + for l:num in range(1, line('$')) + if l:num == 1 + continue + endif + let l:line = getline(l:num) + if strpart(l:line, 0, 1) !=# '#' + return '+1' + elseif l:line =~# '^# -\{24} >8 -\{24}$' + break + endif + endfor " Otherwise, we're still composing our subject return '51' |