Skip to content

Commit 50ea5b7

Browse files
authored
Merge pull request #153 from harshad1/option_to_disable_roman_list
Option to disable roman lists
2 parents 448ad2a + 098da9e commit 50ea5b7

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

plugin/bullets.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ end
6161
if !exists('g:bullets_max_alpha_characters')
6262
let g:bullets_max_alpha_characters = 2
6363
end
64+
65+
if !exists('g:bullets_enable_roman_list')
66+
let g:bullets_enable_roman_list = 1
67+
end
68+
6469
" calculate the decimal equivalent to the last alphabetical list item
6570
let s:power = g:bullets_max_alpha_characters
6671
let s:abc_max = -1
@@ -166,6 +171,10 @@ endfun
166171

167172

168173
fun! s:match_roman_list_item(input_text)
174+
if g:bullets_enable_roman_list == 0
175+
return {}
176+
endif
177+
169178
let l:rom_bullet_regex = join([
170179
\ '\v\C',
171180
\ '^(',

spec/bullets_spec.rb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,41 @@
293293
-
294294
TEXT
295295
end
296+
297+
it 'toggles roman numeral bullets with g:bullets_enable_roman_list' do
298+
filename = "#{SecureRandom.hex(6)}.txt"
299+
write_file(filename, <<-TEXT)
300+
# Hello there
301+
i. this is the first bullet
302+
TEXT
303+
304+
# Disable alpha lists to isolate test to roman numerals
305+
vim.command 'let g:bullets_max_alpha_characters = 0'
306+
vim.command 'let g:bullets_enable_roman_list = 1'
307+
vim.edit filename
308+
vim.type 'GA'
309+
vim.feedkeys '\<cr>'
310+
vim.type 'second bullet'
311+
vim.feedkeys '\<cr>'
312+
vim.type 'third bullet'
313+
vim.command 'let g:bullets_enable_roman_list = 0'
314+
vim.feedkeys '\<cr>'
315+
vim.type 'fourth bullet'
316+
vim.feedkeys '\<cr>'
317+
vim.type 'fifth bullet'
318+
vim.write
319+
320+
file_contents = IO.read(filename)
321+
322+
expect(file_contents).to eq normalize_string_indent(<<-TEXT)
323+
# Hello there
324+
i. this is the first bullet
325+
ii. second bullet
326+
iii. third bullet
327+
fourth bullet
328+
fifth bullet\n
329+
TEXT
330+
end
296331
end
297332
end
298333
end

0 commit comments

Comments
 (0)