commit d5964f0c842ab32706f03b429db2569c4fec9767
parent 536184c59b684befa3ef57cd1a030c32e9f68ef5
Author: Tinmarino <tinmarino@gmail.com>
Date: Sun, 26 Jul 2020 17:55:47 -0400
Feature: blockquote (`> `) better joining (`J`) and hard wrapping (Issue #915)
Wrap: autoadd a new `> ` on new create lines with `setlocal comments+=n:>`
Join: autoremove the inter `> ` with `setlocal formatoptions+=j`
Diffstat:
4 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/.travis.yml b/.travis.yml
@@ -24,13 +24,12 @@ env:
# Define jobs <- vim version <- hard copied from Dockerfile
# First to be launched
- VIM_VERSION=vim_7.3.429
- - VIM_VERSION=nvim_0.2.2
+ - VIM_VERSION=nvim_0.3.8
# More
- VIM_VERSION=vim_7.4.1099
- VIM_VERSION=vim_7.4.1546
- VIM_VERSION=vim_8.0.0027
- VIM_VERSION=vim_8.1.0519
- - VIM_VERSION=nvim_0.3.8
script:
# Run All tests
diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim
@@ -117,15 +117,26 @@ setlocal omnifunc=Complete_wikifiles
" Declare settings necessary for the automatic formatting of lists
+" ------------------------------------------------
setlocal autoindent
setlocal nosmartindent
setlocal nocindent
-setlocal comments=""
+
+" Set comments: to insert and format 'comments' or cheat
+setlocal comments=
+" Used to break blockquote prepending one on each new line (see: #915)
+setlocal comments+=n:>
+
+" Set format options (:h fo-table)
setlocal formatoptions-=c
setlocal formatoptions-=r
setlocal formatoptions-=o
setlocal formatoptions-=2
setlocal formatoptions+=n
+" Used to join blockquotes (see: #915)
+if v:version > 703
+ setlocal formatoptions+=j
+endif
let &formatlistpat = vimwiki#vars#get_wikilocal('rxListItem')
diff --git a/test/issue_markdown.vader b/test/issue_markdown.vader
@@ -8,6 +8,43 @@
Include: vader_includes/vader_setup.vader
+################################################################################
+Execute (Log):
+ Log '#915 Vimwiki Markdown Blockquote Syntax issue'
+ file wiki_test.md
+ call SetSyntax('markdown')
+
+Given vimwiki (One blockquote):
+ > Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla vel.
+
+Do (gqq):
+ gqq
+
+Expect (Well formated and cursor on Sed):
+ > Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus
+ > est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla
+ > vel.
+
+Do (move cursor and gww):
+ fS
+ gww
+ i__HERE__
+
+Expect (Well formated and cursor on Sed):
+ > Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus
+ > est sed facilisis. __HERE__Sed imperdiet massa tellus, eu fermentum felis fringilla
+ > vel.
+
+Given vimwiki (Multiple line blockquote):
+ > Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus
+ > est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla
+ > vel.
+
+Execute (no JJ && Assert for Version > 7.3):
+ normal JJ
+ if v:version > 703
+ AssertEqual getline(1), '> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam faucibus rhoncus est sed facilisis. Sed imperdiet massa tellus, eu fermentum felis fringilla vel.'
+ endif
################################################################################
Execute (Log):
diff --git a/test/run_tests.sh b/test/run_tests.sh
@@ -172,13 +172,13 @@ runVint() {
local err=0
cmd="vint -s . && vint -s test/vimrc"
if echo "$vers" | grep "local" > /dev/null; then
- echo "Running Vint: $cmd : in $wiki_path"
+ echo -e "\nRunning Vint: $cmd : in $wiki_path"
pushd $wiki_path > /dev/null
$cmd
err=$(( $err | $? ))
popd > /dev/null
else
- echo "Starting Docker container and running Vint: $cmd"
+ echo -e "\nStarting Docker container and running Vint: $cmd"
docker run -a stdout "${flags[@]}" bash -c "$cmd"
err=$(( $err | $? ))
fi