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`
This commit is contained in:
Tinmarino 2020-07-26 17:55:47 -04:00
parent 536184c59b
commit d5964f0c84
4 changed files with 52 additions and 5 deletions

View File

@ -24,13 +24,12 @@ env:
# Define jobs <- vim version <- hard copied from Dockerfile # Define jobs <- vim version <- hard copied from Dockerfile
# First to be launched # First to be launched
- VIM_VERSION=vim_7.3.429 - VIM_VERSION=vim_7.3.429
- VIM_VERSION=nvim_0.2.2 - VIM_VERSION=nvim_0.3.8
# More # More
- VIM_VERSION=vim_7.4.1099 - VIM_VERSION=vim_7.4.1099
- VIM_VERSION=vim_7.4.1546 - VIM_VERSION=vim_7.4.1546
- VIM_VERSION=vim_8.0.0027 - VIM_VERSION=vim_8.0.0027
- VIM_VERSION=vim_8.1.0519 - VIM_VERSION=vim_8.1.0519
- VIM_VERSION=nvim_0.3.8
script: script:
# Run All tests # Run All tests

View File

@ -117,15 +117,26 @@ setlocal omnifunc=Complete_wikifiles
" Declare settings necessary for the automatic formatting of lists " Declare settings necessary for the automatic formatting of lists
" ------------------------------------------------
setlocal autoindent setlocal autoindent
setlocal nosmartindent setlocal nosmartindent
setlocal nocindent 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-=c
setlocal formatoptions-=r setlocal formatoptions-=r
setlocal formatoptions-=o setlocal formatoptions-=o
setlocal formatoptions-=2 setlocal formatoptions-=2
setlocal formatoptions+=n setlocal formatoptions+=n
" Used to join blockquotes (see: #915)
if v:version > 703
setlocal formatoptions+=j
endif
let &formatlistpat = vimwiki#vars#get_wikilocal('rxListItem') let &formatlistpat = vimwiki#vars#get_wikilocal('rxListItem')

View File

@ -8,6 +8,43 @@
Include: vader_includes/vader_setup.vader 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): Execute (Log):

View File

@ -172,13 +172,13 @@ runVint() {
local err=0 local err=0
cmd="vint -s . && vint -s test/vimrc" cmd="vint -s . && vint -s test/vimrc"
if echo "$vers" | grep "local" > /dev/null; then 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 pushd $wiki_path > /dev/null
$cmd $cmd
err=$(( $err | $? )) err=$(( $err | $? ))
popd > /dev/null popd > /dev/null
else 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" docker run -a stdout "${flags[@]}" bash -c "$cmd"
err=$(( $err | $? )) err=$(( $err | $? ))
fi fi