From fdcc2d1abe3213eee182a513dbb69b5cc2be2216 Mon Sep 17 00:00:00 2001 From: Marco Herrn Date: Tue, 10 Aug 2021 22:15:26 +0200 Subject: [PATCH] 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.). --- plugin/bullets.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugin/bullets.vim b/plugin/bullets.vim index 6027a7f..f994d11 100644 --- a/plugin/bullets.vim +++ b/plugin/bullets.vim @@ -57,6 +57,12 @@ while s:power >= 0 let s:power -= 1 endwhile +if !exists('g:bullets_list_item_styles') + " A list of regex patterns that are recognized as bullet points for + " bullet items. + let g:bullets_list_item_styles = ['-', '\*+', '\.+', '#\.', '\+', '\\item'] +endif + if !exists('g:bullets_outline_levels') " Capitalization matters: all caps will make the symbol caps, lower = lower " Standard bullets should include the marker symbol after 'std' @@ -248,7 +254,9 @@ fun! s:match_checkbox_bullet_item(input_text) endfun fun! s:match_bullet_list_item(input_text) - let l:std_bullet_regex = '\v(^(\s*)(-|\*+|\.+|#\.|\+|\\item)(\s+))(.*)' + let l:std_bullet_regex = '\v(^(\s*)(' + \ . join(g:bullets_list_item_styles, '|') + \ . ')(\s+))(.*)' let l:matches = matchlist(a:input_text, l:std_bullet_regex) if empty(l:matches)