From 121b137775b8ec9a6c594bdeb9ae53580ec3c7c2 Mon Sep 17 00:00:00 2001 From: Daniel Ashbrook Date: Mon, 16 Aug 2021 12:38:42 +0200 Subject: [PATCH] Add bold+italic matching Modified `wiki#rx#surrounded()` to reverse `a:chars`, which I think is what it was supposed to do anyway. --- autoload/wiki/rx.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autoload/wiki/rx.vim b/autoload/wiki/rx.vim index cdbe2e2b..0dff40c0 100644 --- a/autoload/wiki/rx.vim +++ b/autoload/wiki/rx.vim @@ -9,7 +9,7 @@ function! wiki#rx#surrounded(word, chars) abort " {{{1 \ . '\zs' \ . escape(a:chars, '*') \ . a:word - \ . escape(join(reverse(split(a:chars, '')), ''), '*') + \ . escape(join(reverse(split(a:chars, '\zs')), ''), '*') \ . '\ze' \ . '\%([[:punct:]]\|\s\|$\)\@=' endfunction @@ -31,6 +31,10 @@ let wiki#rx#bold = wiki#rx#surrounded( \ '[^*`[:space:]]\%([^*`]*[^*`[:space:]]\)\?', '*') let wiki#rx#italic = wiki#rx#surrounded( \ '[^_`[:space:]]\%([^_`]*[^_`[:space:]]\)\?', '_') +let wiki#rx#bolditalic = wiki#rx#surrounded( + \ '[^*_`[:space:]]\%([^*_`]*[^*_`[:space:]]\)\?', '*_') +let wiki#rx#italicbold = wiki#rx#surrounded( + \ '[^_*`[:space:]]\%([^_*`]*[^_*`[:space:]]\)\?', '_*') let wiki#rx#date = '\d\d\d\d-\d\d-\d\d' let wiki#rx#url = '\<\l\+:\%(\/\/\)\?[^ \t()\[\]|]\+' let wiki#rx#reftext = '[^\\\[\]]\{-}'