Improve detection of code blocks
This commit is contained in:
parent
3ec0c9cd91
commit
270f542292
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user