From 90b5f1db80050a16c8c0288f05319d4327656043 Mon Sep 17 00:00:00 2001 From: Dorian Karter Date: Sun, 15 Oct 2017 11:32:56 -0500 Subject: [PATCH 1/2] Support for pandoc bullets Closes #12 --- plugin/bullets.vim | 2 +- spec/bullets_spec.rb | 23 +++++++++++++++++++++++ spec/spec_helper.rb | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/plugin/bullets.vim b/plugin/bullets.vim index 2aacc8d..904f7ae 100644 --- a/plugin/bullets.vim +++ b/plugin/bullets.vim @@ -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 From 477146acdefb55e6f89fc448fc5f0c2ed018eb6b Mon Sep 17 00:00:00 2001 From: Dorian Karter Date: Sun, 15 Oct 2017 11:34:37 -0500 Subject: [PATCH 2/2] Bump version --- plugin/bullets.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/bullets.vim b/plugin/bullets.vim index 904f7ae..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