From fa9c2d519b1b320534b355534848b5855baec9ab Mon Sep 17 00:00:00 2001 From: Harshad Vedartham Date: Sun, 21 Apr 2024 09:30:31 -0700 Subject: [PATCH] Used fallback to support old vim --- plugin/bullets.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugin/bullets.vim b/plugin/bullets.vim index 84908c6..e90578b 100644 --- a/plugin/bullets.vim +++ b/plugin/bullets.vim @@ -585,8 +585,14 @@ command! InsertNewBullet call insert_new_bullet() " Helper for Colon Indent " returns 1 if current line ends in a colon, else 0 fun! s:line_ends_in_colon(lnum) - let l:last_char_nr = strgetchar(getline(a:lnum), strcharlen(getline(a:lnum))-1) - return l:last_char_nr == 65306 || l:last_char_nr == 58 + let l:line = getline(a:lnum) + # Older versions of vim do not support strchar* + if exists("*strcharlen") && exists("*strcharget") + let l:last_char_nr = strgetchar(l:line, strcharlen(l:line)-1) + return l:last_char_nr == 65306 || l:last_char_nr == 58 + else + return l:line[strlen(l:line)-1:] ==# ':' + endif endfun " --------------------------------------------------------- }}}