diff --git a/plugin/bullets.vim b/plugin/bullets.vim index 9f9512f..e5e017f 100644 --- a/plugin/bullets.vim +++ b/plugin/bullets.vim @@ -61,6 +61,11 @@ end if !exists('g:bullets_max_alpha_characters') let g:bullets_max_alpha_characters = 2 end + +if !exists('g:bullets_enable_roman_list') + let g:bullets_enable_roman_list = 1 +end + " calculate the decimal equivalent to the last alphabetical list item let s:power = g:bullets_max_alpha_characters let s:abc_max = -1 @@ -166,6 +171,10 @@ endfun fun! s:match_roman_list_item(input_text) + if g:bullets_enable_roman_list == 0 + return {} + endif + let l:rom_bullet_regex = join([ \ '\v\C', \ '^(', diff --git a/spec/bullets_spec.rb b/spec/bullets_spec.rb index 18a71b2..9d91c12 100644 --- a/spec/bullets_spec.rb +++ b/spec/bullets_spec.rb @@ -293,6 +293,41 @@ - TEXT end + + it 'toggles roman numeral bullets with g:bullets_enable_roman_list' do + filename = "#{SecureRandom.hex(6)}.txt" + write_file(filename, <<-TEXT) + # Hello there + i. this is the first bullet + TEXT + + # Disable alpha lists to isolate test to roman numerals + vim.command 'let g:bullets_max_alpha_characters = 0' + vim.command 'let g:bullets_enable_roman_list = 1' + vim.edit filename + vim.type 'GA' + vim.feedkeys '\' + vim.type 'second bullet' + vim.feedkeys '\' + vim.type 'third bullet' + vim.command 'let g:bullets_enable_roman_list = 0' + vim.feedkeys '\' + vim.type 'fourth bullet' + vim.feedkeys '\' + vim.type 'fifth bullet' + vim.write + + file_contents = IO.read(filename) + + expect(file_contents).to eq normalize_string_indent(<<-TEXT) + # Hello there + i. this is the first bullet + ii. second bullet + iii. third bullet + fourth bullet + fifth bullet\n + TEXT + end end end end