Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to disable roman lists #153

Merged
merged 5 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions plugin/bullets.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
\ '^(',
Expand Down
35 changes: 35 additions & 0 deletions spec/bullets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 '\<cr>'
vim.type 'second bullet'
vim.feedkeys '\<cr>'
vim.type 'third bullet'
vim.command 'let g:bullets_enable_roman_list = 0'
vim.feedkeys '\<cr>'
vim.type 'fourth bullet'
vim.feedkeys '\<cr>'
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
Loading