commit 270f54229232a79efcc42227dd112b9d558ee098
parent 3ec0c9cd91fa6d6a803a3164de9564ed0b85d384
Author: Rane Brown <rane.brown@gmail.com>
Date: Fri, 3 Jan 2020 15:14:45 -0700
Improve detection of code blocks
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/autoload/vimwiki/u.vim b/autoload/vimwiki/u.vim
@@ -95,12 +95,14 @@ function! vimwiki#u#map_key(mode, key, plug, ...) abort
endfunction
+" returns 1 if line is a code block or math block
+"
+" The last two conditions are needed for this to correctly
+" detect nested syntaxes within code blocks
function! vimwiki#u#is_codeblock(lnum) abort
let syn_g = synIDattr(synID(a:lnum,1,1),'name')
- if syn_g =~# 'textSnip.*'
- \ || syn_g =~# 'VimwikiPre.*'
- \ || syn_g =~# 'VimwikiMath.*'
- \ || syn_g =~# '.*Comment'
+ if syn_g =~# 'Vimwiki\(Pre.*\|IndentedCodeBlock\|Math.*\)'
+ \ || (syn_g !~# 'Vimwiki.*' && syn_g !=? '')
return 1
else
return 0