Skip to content

Commit 0cc28d5

Browse files
authored
Merge pull request #135 from huynle/master
adding support for '+ [ ]: ' checkboxes
2 parents d9a47f1 + 696d6d0 commit 0cc28d5

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

plugin/bullets.vim

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,9 @@ fun! s:match_checkbox_bullet_item(input_text)
243243
" match any symbols listed in g:bullets_checkbox_markers as well as the
244244
" default ' ', 'x', and 'X'
245245
let l:checkbox_bullet_regex =
246-
\ '\v(^(\s*)([-\*] \[(['
246+
\ '\v(^(\s*)([+-\*] \[(['
247247
\ . g:bullets_checkbox_markers
248-
\ . ' xX])?\])(\s+))(.*)'
248+
\ . ' xX])?\])(:?)(\s+))(.*)'
249249
let l:matches = matchlist(a:input_text, l:checkbox_bullet_regex)
250250

251251
if empty(l:matches)
@@ -256,16 +256,17 @@ fun! s:match_checkbox_bullet_item(input_text)
256256
let l:leading_space = l:matches[2]
257257
let l:bullet = l:matches[3]
258258
let l:checkbox_marker = l:matches[4]
259-
let l:trailing_space = l:matches[5]
260-
let l:text_after_bullet = l:matches[6]
259+
let l:trailing_char = l:matches[5]
260+
let l:trailing_space = l:matches[6]
261+
let l:text_after_bullet = l:matches[7]
261262

262263
return {
263264
\ 'bullet_type': 'chk',
264265
\ 'bullet_length': l:bullet_length,
265266
\ 'leading_space': l:leading_space,
266267
\ 'bullet': l:bullet,
267268
\ 'checkbox_marker': l:checkbox_marker,
268-
\ 'closure': '',
269+
\ 'closure': l:trailing_char,
269270
\ 'trailing_space': l:trailing_space,
270271
\ 'text_after_bullet': l:text_after_bullet
271272
\ }
@@ -591,7 +592,7 @@ endfun
591592
" Checkboxes ---------------------------------------------- {{{
592593
fun! s:find_checkbox_position(lnum)
593594
let l:line_text = getline(a:lnum)
594-
return matchend(l:line_text, '\v\s*(\*|-) \[')
595+
return matchend(l:line_text, '\v\s*(\*|-|\+) \[')
595596
endfun
596597

597598
fun! s:select_checkbox(inner)

0 commit comments

Comments
 (0)