diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2022-06-30 16:59:09 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2022-07-10 22:08:50 +1200 |
commit | 6ca1aeb149b4fbed330af75e2538a22bcb47edd7 (patch) | |
tree | 91d5691675db851fa0c0272ce3d2a9271da47c98 | |
parent | Add explanatory comment for unusual scoping (diff) | |
download | dotfiles-6ca1aeb149b4fbed330af75e2538a22bcb47edd7.tar.gz dotfiles-6ca1aeb149b4fbed330af75e2538a22bcb47edd7.zip |
Translate autoload/gitcommit.vim to vim9script
-rw-r--r-- | vim/autoload/gitcommit.vim | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/vim/autoload/gitcommit.vim b/vim/autoload/gitcommit.vim index 72d2b9ff..3547a2a6 100644 --- a/vim/autoload/gitcommit.vim +++ b/vim/autoload/gitcommit.vim @@ -1,22 +1,24 @@ -" Choose the color column depending on non-comment line count -function! gitcommit#CursorColumn() abort +vim9script - " If we can find a line after the first that isn't a comment, we're - " composing the message - " +# Choose the color column depending on non-comment line count +export def CursorColumn(): string # Not "number"; might be a + prefix + + # If we can find a line after the first that isn't a comment, we're + # composing the message + # for num in range(1, line('$')) if num == 1 continue endif - let line = getline(num) - if strpart(line, 0, 1) !=# '#' + const line = getline(num) + if strpart(line, 0, 1) != '#' return '+1' - elseif line =~# '^# -\{24} >8 -\{24}$' + elseif line =~ '^# -\{24} >8 -\{24}$' break endif endfor - " Otherwise, we're still composing our subject + # Otherwise, we're still composing our subject return '51' -endfunction +enddef |