Skip to content

Commit fdcc2d1

Browse files
committed
Make bullet list item styles configurable
This commit introduces a new option `g:bullets_list_item_styles` to specify a list of regexes that match valid bullet point characters to be recognized by bullets.vim. The default is the same as the currently hardcoded list. This commit only introduces this configurability for bullet list items as this may be the most useful bullet item type to have configurability. It may be considered to provide this configurability for the other bullet item types, too (like checkbox list items, etc.).
1 parent 39d9027 commit fdcc2d1

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

plugin/bullets.vim

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ while s:power >= 0
5757
let s:power -= 1
5858
endwhile
5959

60+
if !exists('g:bullets_list_item_styles')
61+
" A list of regex patterns that are recognized as bullet points for
62+
" bullet items.
63+
let g:bullets_list_item_styles = ['-', '\*+', '\.+', '#\.', '\+', '\\item']
64+
endif
65+
6066
if !exists('g:bullets_outline_levels')
6167
" Capitalization matters: all caps will make the symbol caps, lower = lower
6268
" Standard bullets should include the marker symbol after 'std'
@@ -248,7 +254,9 @@ fun! s:match_checkbox_bullet_item(input_text)
248254
endfun
249255

250256
fun! s:match_bullet_list_item(input_text)
251-
let l:std_bullet_regex = '\v(^(\s*)(-|\*+|\.+|#\.|\+|\\item)(\s+))(.*)'
257+
let l:std_bullet_regex = '\v(^(\s*)('
258+
\ . join(g:bullets_list_item_styles, '|')
259+
\ . ')(\s+))(.*)'
252260
let l:matches = matchlist(a:input_text, l:std_bullet_regex)
253261

254262
if empty(l:matches)

0 commit comments

Comments
 (0)