2018-04-20 07:03:53 +02:00
|
|
|
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
2010-01-20 01:00:00 +01:00
|
|
|
" Vimwiki syntax file
|
2015-02-23 12:10:42 +01:00
|
|
|
" Home: https://github.com/vimwiki/vimwiki/
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
" Quit if syntax file is already loaded
|
2018-02-10 22:04:37 +01:00
|
|
|
if v:version < 600
|
2010-01-20 01:00:00 +01:00
|
|
|
syntax clear
|
|
|
|
elseif exists("b:current_syntax")
|
|
|
|
finish
|
|
|
|
endif
|
2013-07-18 07:55:24 +02:00
|
|
|
|
2016-12-22 19:55:20 +01:00
|
|
|
|
2016-12-28 22:17:08 +01:00
|
|
|
let s:current_syntax = vimwiki#vars#get_wikilocal('syntax')
|
2012-06-07 02:00:00 +02:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2016-12-28 22:17:08 +01:00
|
|
|
call vimwiki#vars#populate_syntax_vars(s:current_syntax)
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
" LINKS: highlighting is complicated due to "nonexistent" links feature
|
|
|
|
function! s:add_target_syntax_ON(target, type)
|
2012-06-07 02:00:00 +02:00
|
|
|
let prefix0 = 'syntax match '.a:type.' `'
|
|
|
|
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
|
|
|
|
let prefix1 = 'syntax match '.a:type.'T `'
|
|
|
|
let suffix1 = '` display contained'
|
|
|
|
execute prefix0. a:target. suffix0
|
|
|
|
execute prefix1. a:target. suffix1
|
2018-04-20 07:03:53 +02:00
|
|
|
endfunction
|
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
function! s:add_target_syntax_OFF(target)
|
2012-06-07 02:00:00 +02:00
|
|
|
let prefix0 = 'syntax match VimwikiNoExistsLink `'
|
|
|
|
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,VimwikiLinkChar'
|
|
|
|
let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
|
|
|
|
let suffix1 = '` display contained'
|
|
|
|
execute prefix0. a:target. suffix0
|
|
|
|
execute prefix1. a:target. suffix1
|
2018-04-20 07:03:53 +02:00
|
|
|
endfunction
|
2012-06-07 02:00:00 +02:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
|
|
|
function! s:highlight_existing_links()
|
2012-06-07 02:00:00 +02:00
|
|
|
" Wikilink
|
|
|
|
" Conditional highlighting that depends on the existence of a wiki file or
|
|
|
|
" directory is only available for *schemeless* wiki links
|
|
|
|
" Links are set up upon BufEnter (see plugin/...)
|
2018-04-20 07:03:53 +02:00
|
|
|
let safe_links = '\%('.vimwiki#base#file_pattern(
|
|
|
|
\ vimwiki#vars#get_bufferlocal('existing_wikifiles')) . '\%(#[^|]*\)\?\|#[^|]*\)'
|
2012-06-07 02:00:00 +02:00
|
|
|
" Wikilink Dirs set up upon BufEnter (see plugin/...)
|
2017-01-12 21:45:09 +01:00
|
|
|
let safe_dirs = vimwiki#base#file_pattern(vimwiki#vars#get_bufferlocal('existing_wikidirs'))
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
" match [[URL]]
|
2014-06-22 16:26:40 +02:00
|
|
|
let target = vimwiki#base#apply_template(
|
2016-12-28 22:17:08 +01:00
|
|
|
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
|
|
|
|
\ safe_links, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
|
2012-06-07 02:00:00 +02:00
|
|
|
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
|
|
|
" match [[URL|DESCRIPTION]]
|
2014-06-22 16:26:40 +02:00
|
|
|
let target = vimwiki#base#apply_template(
|
2016-12-28 22:17:08 +01:00
|
|
|
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
|
|
|
|
\ safe_links, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
|
2012-06-07 02:00:00 +02:00
|
|
|
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
|
|
|
|
|
|
|
" match {{URL}}
|
2014-06-22 16:26:40 +02:00
|
|
|
let target = vimwiki#base#apply_template(
|
2016-12-28 22:17:08 +01:00
|
|
|
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate1')),
|
|
|
|
\ safe_links, vimwiki#vars#get_global('rxWikiInclArgs'), '')
|
2012-06-07 02:00:00 +02:00
|
|
|
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
|
|
|
" match {{URL|...}}
|
2014-06-22 16:26:40 +02:00
|
|
|
let target = vimwiki#base#apply_template(
|
2016-12-28 22:17:08 +01:00
|
|
|
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate2')),
|
|
|
|
\ safe_links, vimwiki#vars#get_global('rxWikiInclArgs'), '')
|
2012-06-07 02:00:00 +02:00
|
|
|
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
|
|
|
" match [[DIRURL]]
|
2014-06-22 16:26:40 +02:00
|
|
|
let target = vimwiki#base#apply_template(
|
2016-12-28 22:17:08 +01:00
|
|
|
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
|
|
|
|
\ safe_dirs, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
|
2012-06-07 02:00:00 +02:00
|
|
|
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
|
|
|
" match [[DIRURL|DESCRIPTION]]
|
2014-06-22 16:26:40 +02:00
|
|
|
let target = vimwiki#base#apply_template(
|
2016-12-28 22:17:08 +01:00
|
|
|
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
|
|
|
|
\ safe_dirs, vimwiki#vars#get_global('rxWikiLinkDescr'), '')
|
2012-06-07 02:00:00 +02:00
|
|
|
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
2018-04-20 07:03:53 +02:00
|
|
|
endfunction
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
" use max highlighting - could be quite slow if there are too many wikifiles
|
2016-12-22 19:55:20 +01:00
|
|
|
if vimwiki#vars#get_wikilocal('maxhi')
|
2012-06-07 02:00:00 +02:00
|
|
|
" WikiLink
|
2017-01-11 22:12:33 +01:00
|
|
|
call s:add_target_syntax_OFF(vimwiki#vars#get_syntaxlocal('rxWikiLink'))
|
2012-06-07 02:00:00 +02:00
|
|
|
" WikiIncl
|
2016-12-28 22:17:08 +01:00
|
|
|
call s:add_target_syntax_OFF(vimwiki#vars#get_global('rxWikiIncl'))
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
" Subsequently, links verified on vimwiki's path are highlighted as existing
|
|
|
|
call s:highlight_existing_links()
|
|
|
|
else
|
|
|
|
" Wikilink
|
2017-01-11 22:12:33 +01:00
|
|
|
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWikiLink'), 'VimwikiLink')
|
2012-06-07 02:00:00 +02:00
|
|
|
" WikiIncl
|
2016-12-28 22:17:08 +01:00
|
|
|
call s:add_target_syntax_ON(vimwiki#vars#get_global('rxWikiIncl'), 'VimwikiLink')
|
2012-06-07 02:00:00 +02:00
|
|
|
endif
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
" Weblink
|
2017-01-12 21:45:09 +01:00
|
|
|
call s:add_target_syntax_ON(vimwiki#vars#get_syntaxlocal('rxWeblink'), 'VimwikiLink')
|
2012-06-07 02:00:00 +02:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
" WikiLink
|
|
|
|
" All remaining schemes are highlighted automatically
|
2014-02-24 12:16:23 +01:00
|
|
|
let s:rxSchemes = '\%('.
|
2018-05-20 15:18:05 +02:00
|
|
|
\ vimwiki#vars#get_global('schemes') . '\|'.
|
|
|
|
\ vimwiki#vars#get_global('web_schemes1').
|
2012-06-07 02:00:00 +02:00
|
|
|
\ '\):'
|
|
|
|
|
|
|
|
" a) match [[nonwiki-scheme-URL]]
|
2014-06-22 16:26:40 +02:00
|
|
|
let s:target = vimwiki#base#apply_template(
|
2016-12-28 22:17:08 +01:00
|
|
|
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate1')),
|
2018-04-20 07:03:53 +02:00
|
|
|
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiLinkUrl'),
|
|
|
|
\ vimwiki#vars#get_global('rxWikiLinkDescr'), '')
|
2014-02-24 12:16:23 +01:00
|
|
|
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
2012-06-07 02:00:00 +02:00
|
|
|
" b) match [[nonwiki-scheme-URL|DESCRIPTION]]
|
2014-06-22 16:26:40 +02:00
|
|
|
let s:target = vimwiki#base#apply_template(
|
2016-12-28 22:17:08 +01:00
|
|
|
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiLinkTemplate2')),
|
2018-04-20 07:03:53 +02:00
|
|
|
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiLinkUrl'),
|
|
|
|
\ vimwiki#vars#get_global('rxWikiLinkDescr'), '')
|
2014-02-24 12:16:23 +01:00
|
|
|
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
" a) match {{nonwiki-scheme-URL}}
|
2014-06-22 16:26:40 +02:00
|
|
|
let s:target = vimwiki#base#apply_template(
|
2016-12-28 22:17:08 +01:00
|
|
|
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate1')),
|
2018-04-20 07:03:53 +02:00
|
|
|
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiInclUrl'),
|
|
|
|
\ vimwiki#vars#get_global('rxWikiInclArgs'), '')
|
2014-02-24 12:16:23 +01:00
|
|
|
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
2012-06-07 02:00:00 +02:00
|
|
|
" b) match {{nonwiki-scheme-URL}[{...}]}
|
2014-06-22 16:26:40 +02:00
|
|
|
let s:target = vimwiki#base#apply_template(
|
2016-12-28 22:17:08 +01:00
|
|
|
\ vimwiki#u#escape(vimwiki#vars#get_global('WikiInclTemplate2')),
|
2018-04-20 07:03:53 +02:00
|
|
|
\ s:rxSchemes.vimwiki#vars#get_global('rxWikiInclUrl'),
|
|
|
|
\ vimwiki#vars#get_global('rxWikiInclArgs'), '')
|
2014-02-24 12:16:23 +01:00
|
|
|
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
|
2010-08-24 02:00:00 +02:00
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
" Header levels, 1-6
|
2014-02-24 12:16:23 +01:00
|
|
|
for s:i in range(1,6)
|
2018-02-10 22:04:37 +01:00
|
|
|
execute 'syntax match VimwikiHeader'.s:i
|
2018-04-20 07:03:53 +02:00
|
|
|
\ . ' /'.vimwiki#vars#get_syntaxlocal('rxH'.s:i, s:current_syntax).
|
|
|
|
\ '/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
|
|
|
|
\ 'VimwikiLink,@Spell'
|
|
|
|
execute 'syntax region VimwikiH'.s:i.'Folding start=/'.
|
|
|
|
\ vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_Start', s:current_syntax).'/ end=/'.
|
|
|
|
\ vimwiki#vars#get_syntaxlocal('rxH'.s:i.'_End', s:current_syntax).
|
|
|
|
\ '/me=s-1 transparent fold'
|
2012-06-07 02:00:00 +02:00
|
|
|
endfor
|
2010-08-24 02:00:00 +02:00
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
" possibly concealed chars
|
2014-02-24 12:16:23 +01:00
|
|
|
let s:conceal = exists("+conceallevel") ? ' conceal' : ''
|
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
execute 'syn match VimwikiEqInChar contained /'.
|
|
|
|
\ vimwiki#vars#get_syntaxlocal('char_eqin').'/'.s:conceal
|
|
|
|
execute 'syn match VimwikiBoldChar contained /'.
|
|
|
|
\ vimwiki#vars#get_syntaxlocal('char_bold').'/'.s:conceal
|
|
|
|
execute 'syn match VimwikiItalicChar contained /'.
|
|
|
|
\ vimwiki#vars#get_syntaxlocal('char_italic').'/'.s:conceal
|
|
|
|
execute 'syn match VimwikiBoldItalicChar contained /'.
|
|
|
|
\ vimwiki#vars#get_syntaxlocal('char_bolditalic').'/'.s:conceal
|
|
|
|
execute 'syn match VimwikiItalicBoldChar contained /'.
|
|
|
|
\ vimwiki#vars#get_syntaxlocal('char_italicbold').'/'.s:conceal
|
|
|
|
execute 'syn match VimwikiCodeChar contained /'.
|
|
|
|
\ vimwiki#vars#get_syntaxlocal('char_code').'/'.s:conceal
|
|
|
|
execute 'syn match VimwikiDelTextChar contained /'.
|
|
|
|
\ vimwiki#vars#get_syntaxlocal('char_deltext').'/'.s:conceal
|
|
|
|
execute 'syn match VimwikiSuperScript contained /'.
|
|
|
|
\ vimwiki#vars#get_syntaxlocal('char_superscript').'/'.s:conceal
|
|
|
|
execute 'syn match VimwikiSubScript contained /'.
|
|
|
|
\ vimwiki#vars#get_syntaxlocal('char_subscript').'/'.s:conceal
|
|
|
|
|
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
|
2010-08-24 02:00:00 +02:00
|
|
|
|
2013-04-19 05:46:58 +02:00
|
|
|
|
2014-02-24 12:16:23 +01:00
|
|
|
let s:options = ' contained transparent contains=NONE'
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2013-04-19 05:46:58 +02:00
|
|
|
" A shortener for long URLs: LinkRest (a middle part of the URL) is concealed
|
|
|
|
" VimwikiLinkRest group is left undefined if link shortening is not desired
|
2016-12-21 21:28:48 +01:00
|
|
|
if exists("+conceallevel") && vimwiki#vars#get_global('url_maxsave') > 0
|
2014-02-24 12:16:23 +01:00
|
|
|
let s:options .= s:conceal
|
2013-04-19 05:46:58 +02:00
|
|
|
execute 'syn match VimwikiLinkRest `\%(///\=[^/ \t]\+/\)\zs\S\+\ze'
|
2016-12-21 21:28:48 +01:00
|
|
|
\.'\%([/#?]\w\|\S\{'.vimwiki#vars#get_global('url_maxsave').'}\)`'.' cchar=~'.s:options
|
2013-04-19 05:46:58 +02:00
|
|
|
endif
|
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
" VimwikiLinkChar is for syntax markers (and also URL when a description
|
|
|
|
" is present) and may be concealed
|
2013-04-19 05:46:58 +02:00
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
" conceal wikilinks
|
2016-12-28 22:17:08 +01:00
|
|
|
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rx_wikilink_prefix').'/'.s:options
|
|
|
|
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rx_wikilink_suffix').'/'.s:options
|
|
|
|
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rx_wikilink_prefix1').'/'.s:options
|
|
|
|
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rx_wikilink_suffix1').'/'.s:options
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
" conceal wikiincls
|
2016-12-28 22:17:08 +01:00
|
|
|
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclPrefix').'/'.s:options
|
|
|
|
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclSuffix').'/'.s:options
|
|
|
|
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclPrefix1').'/'.s:options
|
|
|
|
execute 'syn match VimwikiLinkChar /'.vimwiki#vars#get_global('rxWikiInclSuffix1').'/'.s:options
|
2018-04-20 07:03:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
" non concealed chars
|
|
|
|
execute 'syn match VimwikiHeaderChar contained /\%(^\s*'.
|
|
|
|
\ vimwiki#vars#get_syntaxlocal('rxH').'\+\)\|\%('.vimwiki#vars#get_syntaxlocal('rxH').
|
|
|
|
\ '\+\s*$\)/'
|
|
|
|
execute 'syn match VimwikiEqInCharT contained /'
|
|
|
|
\ .vimwiki#vars#get_syntaxlocal('char_eqin').'/'
|
|
|
|
execute 'syn match VimwikiBoldCharT contained /'
|
|
|
|
\ .vimwiki#vars#get_syntaxlocal('char_bold').'/'
|
|
|
|
execute 'syn match VimwikiItalicCharT contained /'
|
|
|
|
\ .vimwiki#vars#get_syntaxlocal('char_italic').'/'
|
|
|
|
execute 'syn match VimwikiBoldItalicCharT contained /'
|
|
|
|
\ .vimwiki#vars#get_syntaxlocal('char_bolditalic').'/'
|
|
|
|
execute 'syn match VimwikiItalicBoldCharT contained /'
|
|
|
|
\ .vimwiki#vars#get_syntaxlocal('char_italicbold').'/'
|
|
|
|
execute 'syn match VimwikiCodeCharT contained /'
|
|
|
|
\ .vimwiki#vars#get_syntaxlocal('char_code').'/'
|
|
|
|
execute 'syn match VimwikiDelTextCharT contained /'
|
|
|
|
\ .vimwiki#vars#get_syntaxlocal('char_deltext').'/'
|
|
|
|
execute 'syn match VimwikiSuperScriptT contained /'
|
|
|
|
\ .vimwiki#vars#get_syntaxlocal('char_superscript').'/'
|
|
|
|
execute 'syn match VimwikiSubScriptT contained /'
|
|
|
|
\ .vimwiki#vars#get_syntaxlocal('char_subscript').'/'
|
2010-08-24 02:00:00 +02:00
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2016-12-28 22:17:08 +01:00
|
|
|
execute 'syntax match VimwikiTodo /'. vimwiki#vars#get_global('rxTodo') .'/'
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
|
|
|
|
" Tables
|
2013-04-19 05:46:58 +02:00
|
|
|
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
2012-06-07 02:00:00 +02:00
|
|
|
\ transparent contains=VimwikiCellSeparator,
|
|
|
|
\ VimwikiLinkT,
|
|
|
|
\ VimwikiNoExistsLinkT,
|
|
|
|
\ VimwikiTodo,
|
|
|
|
\ VimwikiBoldT,
|
|
|
|
\ VimwikiItalicT,
|
|
|
|
\ VimwikiBoldItalicT,
|
|
|
|
\ VimwikiItalicBoldT,
|
|
|
|
\ VimwikiDelTextT,
|
|
|
|
\ VimwikiSuperScriptT,
|
|
|
|
\ VimwikiSubScriptT,
|
|
|
|
\ VimwikiCodeT,
|
|
|
|
\ VimwikiEqInT,
|
|
|
|
\ @Spell
|
2013-04-19 05:46:58 +02:00
|
|
|
syntax match VimwikiCellSeparator
|
2010-02-23 01:00:00 +01:00
|
|
|
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2013-07-18 07:55:24 +02:00
|
|
|
" Lists
|
2019-01-17 21:57:42 +01:00
|
|
|
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB').'/'
|
2016-12-28 22:17:08 +01:00
|
|
|
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/'
|
2019-01-17 21:57:42 +01:00
|
|
|
execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_syntaxlocal('rxListItem').'/'
|
2013-07-08 11:37:35 +02:00
|
|
|
|
2016-12-21 19:43:34 +01:00
|
|
|
if vimwiki#vars#get_global('hl_cb_checked') == 1
|
2019-01-17 21:57:42 +01:00
|
|
|
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_syntaxlocal('rxListItemWithoutCB')
|
|
|
|
\ . '\s*\[['.vimwiki#vars#get_syntaxlocal('listsyms_list')[-1]
|
2018-04-03 19:45:19 +02:00
|
|
|
\ . vimwiki#vars#get_global('listsym_rejected')
|
|
|
|
\ . ']\]\s.*$/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
2016-12-21 19:43:34 +01:00
|
|
|
elseif vimwiki#vars#get_global('hl_cb_checked') == 2
|
2018-04-03 19:45:19 +02:00
|
|
|
execute 'syntax match VimwikiCheckBoxDone /'
|
2019-01-17 21:57:42 +01:00
|
|
|
\ . vimwiki#vars#get_syntaxlocal('rxListItemAndChildren')
|
2018-04-03 19:45:19 +02:00
|
|
|
\ .'/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
|
2012-06-07 02:00:00 +02:00
|
|
|
endif
|
|
|
|
|
2013-07-08 11:37:35 +02:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
execute 'syntax match VimwikiEqIn /'.vimwiki#vars#get_syntaxlocal('rxEqIn').
|
|
|
|
\ '/ contains=VimwikiEqInChar'
|
|
|
|
execute 'syntax match VimwikiEqInT /'.vimwiki#vars#get_syntaxlocal('rxEqIn').
|
|
|
|
\ '/ contained contains=VimwikiEqInCharT'
|
|
|
|
|
|
|
|
execute 'syntax match VimwikiBold /'.vimwiki#vars#get_syntaxlocal('rxBold').
|
|
|
|
\ '/ contains=VimwikiBoldChar,@Spell'
|
|
|
|
execute 'syntax match VimwikiBoldT /'.vimwiki#vars#get_syntaxlocal('rxBold').
|
|
|
|
\ '/ contained contains=VimwikiBoldCharT,@Spell'
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
execute 'syntax match VimwikiItalic /'.vimwiki#vars#get_syntaxlocal('rxItalic').
|
|
|
|
\ '/ contains=VimwikiItalicChar,@Spell'
|
|
|
|
execute 'syntax match VimwikiItalicT /'.vimwiki#vars#get_syntaxlocal('rxItalic').
|
|
|
|
\ '/ contained contains=VimwikiItalicCharT,@Spell'
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
execute 'syntax match VimwikiBoldItalic /'.vimwiki#vars#get_syntaxlocal('rxBoldItalic').
|
|
|
|
\ '/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar,@Spell'
|
|
|
|
execute 'syntax match VimwikiBoldItalicT /'.vimwiki#vars#get_syntaxlocal('rxBoldItalic').
|
|
|
|
\ '/ contained contains=VimwikiBoldItalicChatT,VimwikiItalicBoldCharT,@Spell'
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
execute 'syntax match VimwikiItalicBold /'.vimwiki#vars#get_syntaxlocal('rxItalicBold').
|
|
|
|
\ '/ contains=VimwikiBoldItalicChar,VimwikiItalicBoldChar,@Spell'
|
|
|
|
execute 'syntax match VimwikiItalicBoldT /'.vimwiki#vars#get_syntaxlocal('rxItalicBold').
|
|
|
|
\ '/ contained contains=VimwikiBoldItalicCharT,VimsikiItalicBoldCharT,@Spell'
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
execute 'syntax match VimwikiDelText /'.vimwiki#vars#get_syntaxlocal('rxDelText').
|
|
|
|
\ '/ contains=VimwikiDelTextChar,@Spell'
|
|
|
|
execute 'syntax match VimwikiDelTextT /'.vimwiki#vars#get_syntaxlocal('rxDelText').
|
|
|
|
\ '/ contained contains=VimwikiDelTextChar,@Spell'
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
execute 'syntax match VimwikiSuperScript /'.vimwiki#vars#get_syntaxlocal('rxSuperScript').
|
|
|
|
\ '/ contains=VimwikiSuperScriptChar,@Spell'
|
|
|
|
execute 'syntax match VimwikiSuperScriptT /'.vimwiki#vars#get_syntaxlocal('rxSuperScript').
|
|
|
|
\ '/ contained contains=VimwikiSuperScriptCharT,@Spell'
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
execute 'syntax match VimwikiSubScript /'.vimwiki#vars#get_syntaxlocal('rxSubScript').
|
|
|
|
\ '/ contains=VimwikiSubScriptChar,@Spell'
|
|
|
|
execute 'syntax match VimwikiSubScriptT /'.vimwiki#vars#get_syntaxlocal('rxSubScript').
|
|
|
|
\ '/ contained contains=VimwikiSubScriptCharT,@Spell'
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
execute 'syntax match VimwikiCode /'.vimwiki#vars#get_syntaxlocal('rxCode').
|
|
|
|
\ '/ contains=VimwikiCodeChar'
|
|
|
|
execute 'syntax match VimwikiCodeT /'.vimwiki#vars#get_syntaxlocal('rxCode').
|
|
|
|
\ '/ contained contains=VimwikiCodeCharT'
|
2010-01-20 01:00:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
" <hr> horizontal rule
|
2017-01-04 21:53:03 +01:00
|
|
|
execute 'syntax match VimwikiHR /'.vimwiki#vars#get_syntaxlocal('rxHR').'/'
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2017-01-04 21:53:03 +01:00
|
|
|
execute 'syntax region VimwikiPre start=/'.vimwiki#vars#get_syntaxlocal('rxPreStart').
|
|
|
|
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxPreEnd').'/ contains=@Spell'
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2017-01-04 21:53:03 +01:00
|
|
|
execute 'syntax region VimwikiMath start=/'.vimwiki#vars#get_syntaxlocal('rxMathStart').
|
|
|
|
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxMathEnd').'/ contains=@Spell'
|
2012-06-07 02:00:00 +02:00
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2010-05-12 02:00:00 +02:00
|
|
|
" placeholders
|
|
|
|
syntax match VimwikiPlaceholder /^\s*%nohtml\s*$/
|
2018-04-20 07:03:53 +02:00
|
|
|
syntax match VimwikiPlaceholder
|
|
|
|
\ /^\s*%title\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
|
|
|
|
syntax match VimwikiPlaceholder
|
|
|
|
\ /^\s*%date\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
|
|
|
|
syntax match VimwikiPlaceholder
|
|
|
|
\ /^\s*%template\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
|
2018-02-16 18:11:49 +01:00
|
|
|
syntax match VimwikiPlaceholderParam /.*/ contained
|
2010-05-12 02:00:00 +02:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2010-05-12 02:00:00 +02:00
|
|
|
" html tags
|
2016-12-21 21:28:48 +01:00
|
|
|
if vimwiki#vars#get_global('valid_html_tags') != ''
|
|
|
|
let s:html_tags = join(split(vimwiki#vars#get_global('valid_html_tags'), '\s*,\s*'), '\|')
|
2014-02-24 12:16:23 +01:00
|
|
|
exe 'syntax match VimwikiHTMLtag #\c</\?\%('.s:html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#'
|
2012-06-07 02:00:00 +02:00
|
|
|
execute 'syntax match VimwikiBold #\c<b>.\{-}</b># contains=VimwikiHTMLTag'
|
|
|
|
execute 'syntax match VimwikiItalic #\c<i>.\{-}</i># contains=VimwikiHTMLTag'
|
|
|
|
execute 'syntax match VimwikiUnderline #\c<u>.\{-}</u># contains=VimwikiHTMLTag'
|
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
execute 'syntax match VimwikiComment /'.vimwiki#vars#get_syntaxlocal('rxComment').
|
|
|
|
\ '/ contains=@Spell,VimwikiTodo'
|
2012-06-07 02:00:00 +02:00
|
|
|
endif
|
2015-01-04 23:44:24 +01:00
|
|
|
|
|
|
|
" tags
|
2017-01-04 21:53:03 +01:00
|
|
|
execute 'syntax match VimwikiTag /'.vimwiki#vars#get_syntaxlocal('rxTags').'/'
|
2015-01-04 23:44:24 +01:00
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
" header groups highlighting
|
2016-12-21 19:43:34 +01:00
|
|
|
if vimwiki#vars#get_global('hl_headers') == 0
|
2012-06-07 02:00:00 +02:00
|
|
|
" Strangely in default colorscheme Title group is not set to bold for cterm...
|
|
|
|
if !exists("g:colors_name")
|
|
|
|
hi Title cterm=bold
|
2011-06-11 02:00:00 +02:00
|
|
|
endif
|
2014-02-24 12:16:23 +01:00
|
|
|
for s:i in range(1,6)
|
|
|
|
execute 'hi def link VimwikiHeader'.s:i.' Title'
|
2012-06-07 02:00:00 +02:00
|
|
|
endfor
|
|
|
|
else
|
2014-02-24 12:16:23 +01:00
|
|
|
for s:i in range(1,6)
|
2017-11-11 21:52:07 +01:00
|
|
|
execute 'hi def VimwikiHeader'.s:i.' guibg=bg guifg='
|
|
|
|
\ .vimwiki#vars#get_global('hcolor_guifg_'.&bg)[s:i-1].' gui=bold ctermfg='
|
|
|
|
\ .vimwiki#vars#get_global('hcolor_ctermfg_'.&bg)[s:i-1].' term=bold cterm=bold'
|
2012-06-07 02:00:00 +02:00
|
|
|
endfor
|
2010-01-20 01:00:00 +01:00
|
|
|
endif
|
2012-06-07 02:00:00 +02:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
hi def link VimwikiMarkers Normal
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
hi def link VimwikiEqIn Number
|
|
|
|
hi def link VimwikiEqInT VimwikiEqIn
|
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
hi def VimwikiBold term=bold cterm=bold gui=bold
|
2010-08-24 02:00:00 +02:00
|
|
|
hi def link VimwikiBoldT VimwikiBold
|
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
hi def VimwikiItalic term=italic cterm=italic gui=italic
|
2010-08-24 02:00:00 +02:00
|
|
|
hi def link VimwikiItalicT VimwikiItalic
|
|
|
|
|
2019-03-14 22:21:04 +01:00
|
|
|
hi def VimwikiBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
|
2010-01-20 01:00:00 +01:00
|
|
|
hi def link VimwikiItalicBold VimwikiBoldItalic
|
2010-08-24 02:00:00 +02:00
|
|
|
hi def link VimwikiBoldItalicT VimwikiBoldItalic
|
|
|
|
hi def link VimwikiItalicBoldT VimwikiBoldItalic
|
|
|
|
|
|
|
|
hi def VimwikiUnderline gui=underline
|
2010-01-20 01:00:00 +01:00
|
|
|
|
|
|
|
hi def link VimwikiCode PreProc
|
2010-08-24 02:00:00 +02:00
|
|
|
hi def link VimwikiCodeT VimwikiCode
|
|
|
|
|
2010-05-12 02:00:00 +02:00
|
|
|
hi def link VimwikiPre PreProc
|
2010-08-24 02:00:00 +02:00
|
|
|
hi def link VimwikiPreT VimwikiPre
|
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
hi def link VimwikiMath Number
|
|
|
|
hi def link VimwikiMathT VimwikiMath
|
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
hi def link VimwikiNoExistsLink SpellBad
|
|
|
|
hi def link VimwikiNoExistsLinkT VimwikiNoExistsLink
|
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
hi def link VimwikiLink Underlined
|
2011-06-11 02:00:00 +02:00
|
|
|
hi def link VimwikiLinkT VimwikiLink
|
2010-08-24 02:00:00 +02:00
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
hi def link VimwikiList Identifier
|
2012-06-07 02:00:00 +02:00
|
|
|
hi def link VimwikiListTodo VimwikiList
|
2010-01-20 01:00:00 +01:00
|
|
|
hi def link VimwikiCheckBoxDone Comment
|
2012-06-07 02:00:00 +02:00
|
|
|
hi def link VimwikiHR Identifier
|
2015-01-04 23:44:24 +01:00
|
|
|
hi def link VimwikiTag Keyword
|
2010-08-24 02:00:00 +02:00
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
hi def link VimwikiDelText Constant
|
2010-08-24 02:00:00 +02:00
|
|
|
hi def link VimwikiDelTextT VimwikiDelText
|
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
hi def link VimwikiSuperScript Number
|
2010-08-24 02:00:00 +02:00
|
|
|
hi def link VimwikiSuperScriptT VimwikiSuperScript
|
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
hi def link VimwikiSubScript Number
|
2010-08-24 02:00:00 +02:00
|
|
|
hi def link VimwikiSubScriptT VimwikiSubScript
|
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
hi def link VimwikiTodo Todo
|
|
|
|
hi def link VimwikiComment Comment
|
2010-02-23 01:00:00 +01:00
|
|
|
|
2010-05-12 02:00:00 +02:00
|
|
|
hi def link VimwikiPlaceholder SpecialKey
|
2010-08-24 02:00:00 +02:00
|
|
|
hi def link VimwikiPlaceholderParam String
|
2010-05-12 02:00:00 +02:00
|
|
|
hi def link VimwikiHTMLtag SpecialKey
|
2010-08-24 02:00:00 +02:00
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
hi def link VimwikiEqInChar VimwikiMarkers
|
2011-06-11 02:00:00 +02:00
|
|
|
hi def link VimwikiCellSeparator VimwikiMarkers
|
|
|
|
hi def link VimwikiBoldChar VimwikiMarkers
|
|
|
|
hi def link VimwikiItalicChar VimwikiMarkers
|
|
|
|
hi def link VimwikiBoldItalicChar VimwikiMarkers
|
|
|
|
hi def link VimwikiItalicBoldChar VimwikiMarkers
|
|
|
|
hi def link VimwikiDelTextChar VimwikiMarkers
|
|
|
|
hi def link VimwikiSuperScriptChar VimwikiMarkers
|
|
|
|
hi def link VimwikiSubScriptChar VimwikiMarkers
|
|
|
|
hi def link VimwikiCodeChar VimwikiMarkers
|
|
|
|
hi def link VimwikiHeaderChar VimwikiMarkers
|
2010-08-24 02:00:00 +02:00
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
hi def link VimwikiEqInCharT VimwikiMarkers
|
2011-06-11 02:00:00 +02:00
|
|
|
hi def link VimwikiBoldCharT VimwikiMarkers
|
|
|
|
hi def link VimwikiItalicCharT VimwikiMarkers
|
|
|
|
hi def link VimwikiBoldItalicCharT VimwikiMarkers
|
|
|
|
hi def link VimwikiItalicBoldCharT VimwikiMarkers
|
|
|
|
hi def link VimwikiDelTextCharT VimwikiMarkers
|
|
|
|
hi def link VimwikiSuperScriptCharT VimwikiMarkers
|
|
|
|
hi def link VimwikiSubScriptCharT VimwikiMarkers
|
|
|
|
hi def link VimwikiCodeCharT VimwikiMarkers
|
|
|
|
hi def link VimwikiHeaderCharT VimwikiMarkers
|
2010-08-24 02:00:00 +02:00
|
|
|
hi def link VimwikiLinkCharT VimwikiLinkT
|
2012-06-07 02:00:00 +02:00
|
|
|
hi def link VimwikiNoExistsLinkCharT VimwikiNoExistsLinkT
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
" Load syntax-specific functionality
|
2013-07-18 07:55:24 +02:00
|
|
|
call vimwiki#u#reload_regexes_custom()
|
2012-06-07 02:00:00 +02:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2013-04-19 05:46:58 +02:00
|
|
|
" FIXME it now does not make sense to pretend there is a single syntax "vimwiki"
|
2010-01-20 01:00:00 +01:00
|
|
|
let b:current_syntax="vimwiki"
|
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
|
|
|
" EMBEDDED syntax setup
|
2016-12-22 19:12:03 +01:00
|
|
|
let s:nested = vimwiki#vars#get_wikilocal('nested_syntaxes')
|
|
|
|
if vimwiki#vars#get_wikilocal('automatic_nested_syntaxes')
|
2016-05-17 20:29:59 +02:00
|
|
|
let s:nested = extend(s:nested, vimwiki#base#detect_nested_syntax(), "keep")
|
2016-01-27 16:30:30 +01:00
|
|
|
endif
|
2014-02-24 12:16:23 +01:00
|
|
|
if !empty(s:nested)
|
|
|
|
for [s:hl_syntax, s:vim_syntax] in items(s:nested)
|
|
|
|
call vimwiki#base#nested_syntax(s:vim_syntax,
|
2017-01-04 21:53:03 +01:00
|
|
|
\ vimwiki#vars#get_syntaxlocal('rxPreStart').'\%(.*[[:blank:][:punct:]]\)\?'.
|
2014-02-24 12:16:23 +01:00
|
|
|
\ s:hl_syntax.'\%([[:blank:][:punct:]].*\)\?',
|
2017-01-04 21:53:03 +01:00
|
|
|
\ vimwiki#vars#get_syntaxlocal('rxPreEnd'), 'VimwikiPre')
|
2010-01-20 01:00:00 +01:00
|
|
|
endfor
|
|
|
|
endif
|
2018-04-20 07:03:53 +02:00
|
|
|
|
|
|
|
|
2012-07-07 02:00:00 +02:00
|
|
|
" LaTeX
|
2013-04-19 05:46:58 +02:00
|
|
|
call vimwiki#base#nested_syntax('tex',
|
2017-01-04 21:53:03 +01:00
|
|
|
\ vimwiki#vars#get_syntaxlocal('rxMathStart').'\%(.*[[:blank:][:punct:]]\)\?'.
|
2012-07-07 02:00:00 +02:00
|
|
|
\ '\%([[:blank:][:punct:]].*\)\?',
|
2017-01-04 21:53:03 +01:00
|
|
|
\ vimwiki#vars#get_syntaxlocal('rxMathEnd'), 'VimwikiMath')
|
2012-06-07 02:00:00 +02:00
|
|
|
|
2013-04-19 05:46:58 +02:00
|
|
|
|
|
|
|
syntax spell toplevel
|
2018-04-20 07:03:53 +02:00
|
|
|
|