diff --git a/plugin/bullets.vim b/plugin/bullets.vim index 2aacc8d..97f51eb 100644 --- a/plugin/bullets.vim +++ b/plugin/bullets.vim @@ -1,5 +1,5 @@ " Vim plugin for automated bulleted lists -" Last Change: Tue 18 Apr 2017 +" Last Change: Sun 15 Oct 2017 " Maintainer: Dorian Karter " License: MIT " FileTypes: markdown, text, gitcommit @@ -85,7 +85,7 @@ fun! s:match_roman_list_item(input_text) endfun fun! s:match_bullet_list_item(input_text) - let l:std_bullet_regex = '\v(^\s*(-|*|\\item)( \[[x ]?\])? )(.*)' + let l:std_bullet_regex = '\v(^\s*(-|*|#.|\\item)( \[[x ]?\])? )(.*)' let l:matches = matchlist(a:input_text, l:std_bullet_regex) if empty(l:matches) diff --git a/spec/bullets_spec.rb b/spec/bullets_spec.rb index 54db346..38d8240 100644 --- a/spec/bullets_spec.rb +++ b/spec/bullets_spec.rb @@ -53,6 +53,28 @@ EOF end + it 'adds a pandoc bullet if the prev line had one' do + filename = "#{SecureRandom.hex(6)}.md" + write_file(filename, <<-EOF) + Hello there + #. this is the first bullet + EOF + + vim.edit filename + vim.type 'GA' + vim.feedkeys '\' + vim.type 'second bullet' + vim.write + + file_contents = IO.read(filename) + + expect(file_contents).to eq normalize_string_indent(<<-EOF) + Hello there + #. this is the first bullet + #. second bullet\n + EOF + end + it 'adds a new numeric bullet if the previous line had numeric bullet' do filename = "#{SecureRandom.hex(6)}.md" write_file(filename, <<-EOF) @@ -96,6 +118,7 @@ second line\n EOF end + it 'adds a new roman numeral bullet' do filename = "#{SecureRandom.hex(6)}.md" write_file(filename, <<-EOF) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5bb85dd..0f9e570 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,6 @@ require 'vimrunner' require 'vimrunner/rspec' +require 'securerandom' Vimrunner::RSpec.configure do |config| # Use a single Vim instance for the test suite. Set to false to use an