Skip to content

Commit

Permalink
Merge pull request #135 from huynle/master
Browse files Browse the repository at this point in the history
adding support for '+ [ ]: ' checkboxes
  • Loading branch information
harshad1 committed Mar 8, 2024
2 parents d9a47f1 + 696d6d0 commit 0cc28d5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions plugin/bullets.vim
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ fun! s:match_checkbox_bullet_item(input_text)
" match any symbols listed in g:bullets_checkbox_markers as well as the
" default ' ', 'x', and 'X'
let l:checkbox_bullet_regex =
\ '\v(^(\s*)([-\*] \[(['
\ '\v(^(\s*)([+-\*] \[(['
\ . g:bullets_checkbox_markers
\ . ' xX])?\])(\s+))(.*)'
\ . ' xX])?\])(:?)(\s+))(.*)'
let l:matches = matchlist(a:input_text, l:checkbox_bullet_regex)

if empty(l:matches)
Expand All @@ -256,16 +256,17 @@ fun! s:match_checkbox_bullet_item(input_text)
let l:leading_space = l:matches[2]
let l:bullet = l:matches[3]
let l:checkbox_marker = l:matches[4]
let l:trailing_space = l:matches[5]
let l:text_after_bullet = l:matches[6]
let l:trailing_char = l:matches[5]
let l:trailing_space = l:matches[6]
let l:text_after_bullet = l:matches[7]

return {
\ 'bullet_type': 'chk',
\ 'bullet_length': l:bullet_length,
\ 'leading_space': l:leading_space,
\ 'bullet': l:bullet,
\ 'checkbox_marker': l:checkbox_marker,
\ 'closure': '',
\ 'closure': l:trailing_char,
\ 'trailing_space': l:trailing_space,
\ 'text_after_bullet': l:text_after_bullet
\ }
Expand Down Expand Up @@ -591,7 +592,7 @@ endfun
" Checkboxes ---------------------------------------------- {{{
fun! s:find_checkbox_position(lnum)
let l:line_text = getline(a:lnum)
return matchend(l:line_text, '\v\s*(\*|-) \[')
return matchend(l:line_text, '\v\s*(\*|-|\+) \[')
endfun

fun! s:select_checkbox(inner)
Expand Down

0 comments on commit 0cc28d5

Please sign in to comment.