Support for \textit and \textbf

Thanks to comment by @2sev on commit 4cbb663.
This commit is contained in:
Karl Yngve Lervåg 2015-12-06 22:31:18 +01:00
parent 9878c66b34
commit 09a9d0f9de

View File

@ -11,17 +11,23 @@ elseif b:current_syntax !=# 'tex'
finish finish
endif endif
" {{{1 Add italic font and conceal for \emph " {{{1 Italic font, bold font and conceals
if has('conceal') && get(g:, 'tex_conceal', 'b') =~# 'b'
syntax region texItalStyle let conceal = (has('conceal') && get(g:, 'tex_conceal', 'b') =~# 'b')
\ matchgroup=texTypeStyle start="\\emph\s*{" end="}" \ ? 'concealends' : ''
\ contains=@texItalGroup concealends
else for [style, group, commands] in [
syntax region texItalStyle \ ['texItalStyle', 'texItalGroup', ['emph', 'textit']],
\ matchgroup=texTypeStyle start="\\emph\s*{" end="}" \ ['texBoldStyle', 'texBoldGroup', ['textbf']],
\ contains=@texItalGroup \]
endif for cmd in commands
syntax cluster texMatchGroup add=texItalStyle execute 'syntax region' style 'matchgroup=texTypeStyle'
\ 'start="\\' . cmd . '\s*{" end="}"'
\ 'contains=@' . group
\ conceal
endfor
execute 'syntax cluster texMatchGroup add=' . style
endfor
" }}}1 " }}}1
" {{{1 Add syntax highlighting for \url and \href " {{{1 Add syntax highlighting for \url and \href