Skip to content

Commit d39bfa8

Browse files
committed
Allow disabling alphabetic bullets
1 parent deee79e commit d39bfa8

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

doc/bullets.txt

+13
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,19 @@ This tends to be fine even if you don't use it, but it can be disabled with:
152152
`let g:bullets_pad_right = 0`
153153

154154

155+
Alphabetic Bullet Max Size
156+
--------------------------
157+
To avoid falsely detecting a word as an alphabetic bullet we have limited the
158+
max size of an alphabetic bullets to `2` characters using the following setting:
159+
160+
`let g:bullets_max_alpha_characters = 2`
161+
162+
You can change this setting in certain file types if you are not worried about
163+
that using auto commands.
164+
165+
When changed to `0` this will disable alphabetic bullets altogether.
166+
167+
155168
INSERTING BULLETS *bullets-insert-new-bullet*
156169

157170
When a supported file type is opened (see |bullets-configuration|) you can start

plugin/bullets.vim

+4
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ fun! s:match_roman_list_item(input_text)
122122
endfun
123123

124124
fun! s:match_alphabetical_list_item(input_text)
125+
if g:bullets_max_alpha_characters == 0
126+
return {}
127+
endif
128+
125129
let l:abc_bullet_regex = join([
126130
\ '\v^((\s*)(\u{1,',
127131
\ string(g:bullets_max_alpha_characters),

spec/alphabetic_bullets_spec.rb

+23
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,29 @@
127127
not a bullet\n
128128
TEXT
129129
end
130+
131+
it 'does not bullets if configured as 0' do
132+
filename = "#{SecureRandom.hex(6)}.txt"
133+
write_file(filename, <<-TEXT)
134+
# Hello there
135+
a. this is the first bullet
136+
TEXT
137+
138+
vim.command 'let g:bullets_max_alpha_characters = 0'
139+
vim.edit filename
140+
vim.type 'GA'
141+
vim.feedkeys '\<cr>'
142+
vim.type 'not a bullet'
143+
vim.write
144+
145+
file_contents = IO.read(filename)
146+
147+
expect(file_contents).to eq normalize_string_indent(<<-TEXT)
148+
# Hello there
149+
a. this is the first bullet
150+
not a bullet\n
151+
TEXT
152+
end
130153
end
131154
end
132155
end

0 commit comments

Comments
 (0)