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
|
2019-12-21 04:41:03 +01:00
|
|
|
elseif exists('b:current_syntax')
|
2010-01-20 01:00:00 +01:00
|
|
|
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
|
|
|
|
2020-08-02 04:28:32 +02:00
|
|
|
" Get config: possibly concealed chars
|
|
|
|
let b:vimwiki_syntax_conceal = exists('+conceallevel') ? ' conceal' : ''
|
|
|
|
let b:vimwiki_syntax_concealends = has('conceal') ? ' concealends' : ''
|
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2020-08-04 00:45:46 +02:00
|
|
|
" Populate all syntax vars
|
|
|
|
" Include syntax/vimwiki_markdown.vim as "side effect"
|
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
|
|
|
|
2020-08-04 04:16:50 +02:00
|
|
|
let syntax_dic = g:vimwiki_syntax_variables[s:current_syntax]
|
|
|
|
|
|
|
|
" text: `code` or ``code`` only inline
|
|
|
|
" Note: `\%(^\|[^`]\)\@<=` means after a new line or a non `
|
|
|
|
let syntax_dic.dTypeface.code = [
|
|
|
|
\ ['\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@=',
|
|
|
|
\ '\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@='],
|
|
|
|
\ ['\%(^\|[^`]\)\@<=``\%($\|[^`]\)\@=',
|
|
|
|
\ '\%(^\|[^`]\)\@<=``\%($\|[^`]\)\@='],
|
|
|
|
\ ]
|
|
|
|
|
|
|
|
" text: ~~deleted text~~
|
|
|
|
let syntax_dic.dTypeface.del = ([
|
|
|
|
\ ['\~\~', '\~\~']])
|
|
|
|
|
|
|
|
" text: $ equation_inline $
|
|
|
|
" Match only one $
|
|
|
|
" ( ^ or not $) before $ and after: not $
|
|
|
|
let syntax_dic.dTypeface.eq = ([
|
|
|
|
\ ['\%(^\|[^$]\)\@<=\$\%($\|[^$]\)\@=',
|
|
|
|
\ '\%(^\|[^$]\)\@<=\$\%($\|[^$]\)\@=']])
|
|
|
|
|
|
|
|
" text: ^superscript^
|
|
|
|
let syntax_dic.dTypeface.sup = ([
|
|
|
|
\ ['\^', '\^']])
|
|
|
|
|
|
|
|
" text: ,,subscript,,
|
|
|
|
let syntax_dic.dTypeface.sub = ([
|
|
|
|
\ [',,', ',,']])
|
|
|
|
|
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
|
2019-12-21 04:41:03 +01:00
|
|
|
function! s:add_target_syntax_ON(target, type) abort
|
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
|
|
|
|
2019-12-21 04:41:03 +01:00
|
|
|
function! s:add_target_syntax_OFF(target) abort
|
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
|
|
|
|
2019-12-21 04:41:03 +01:00
|
|
|
function! s:highlight_existing_links() abort
|
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')),
|
2020-06-02 01:33:06 +02:00
|
|
|
\ 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')),
|
2020-06-02 01:33:06 +02:00
|
|
|
\ 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')),
|
2020-06-02 01:33:06 +02:00
|
|
|
\ 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')),
|
2020-06-02 01:33:06 +02:00
|
|
|
\ 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')),
|
2020-06-02 01:33:06 +02:00
|
|
|
\ 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')),
|
2020-06-02 01:33:06 +02:00
|
|
|
\ 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'),
|
2020-06-02 01:33:06 +02:00
|
|
|
\ 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'),
|
2020-06-02 01:33:06 +02:00
|
|
|
\ 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'),
|
2020-06-02 01:33:06 +02:00
|
|
|
\ 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'),
|
2020-06-02 01:33:06 +02:00
|
|
|
\ 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
|
|
|
|
2014-02-24 12:16:23 +01:00
|
|
|
let s:options = ' contained transparent contains=NONE'
|
2019-12-21 04:41:03 +01:00
|
|
|
if exists('+conceallevel')
|
2020-08-02 04:28:32 +02:00
|
|
|
let s:options .= b:vimwiki_syntax_conceal
|
2019-03-31 05:52:56 +02:00
|
|
|
endif
|
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
|
2019-12-21 04:41:03 +01:00
|
|
|
if exists('+conceallevel') && vimwiki#vars#get_global('url_maxsave') > 0
|
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*$\)/'
|
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
|
2019-05-09 04:55:56 +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
|
2020-08-04 00:45:46 +02:00
|
|
|
|
2019-05-09 04:55:56 +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
|
2020-06-04 18:33:12 +02:00
|
|
|
execute 'syntax match VimwikiList /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB').'/'
|
2016-12-28 22:17:08 +01:00
|
|
|
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/'
|
2020-06-04 18:33:12 +02:00
|
|
|
execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_wikilocal('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
|
2020-06-04 18:33:12 +02:00
|
|
|
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB')
|
|
|
|
\ . '\s*\[['.vimwiki#vars#get_wikilocal('listsyms_list')[-1]
|
2018-04-03 19:45:19 +02:00
|
|
|
\ . vimwiki#vars#get_global('listsym_rejected')
|
2019-05-09 04:55:56 +02:00
|
|
|
\ . ']\]\s.*$/ contains=VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@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 /'
|
2020-06-04 18:33:12 +02:00
|
|
|
\ . vimwiki#vars#get_wikilocal('rxListItemAndChildren')
|
2019-05-09 04:55:56 +02:00
|
|
|
\ .'/ contains=VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
2012-06-07 02:00:00 +02:00
|
|
|
endif
|
|
|
|
|
2013-07-08 11:37:35 +02:00
|
|
|
|
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
|
|
|
|
2019-03-28 22:49:42 +01:00
|
|
|
let concealpre = vimwiki#vars#get_global('conceal_pre') ? ' concealends' : ''
|
|
|
|
execute 'syntax region VimwikiPre matchgroup=VimwikiPreDelim start=/'.vimwiki#vars#get_syntaxlocal('rxPreStart').
|
2019-05-24 05:47:14 +02:00
|
|
|
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxPreEnd').'/ contains=@NoSpell'.concealpre
|
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').
|
2019-05-24 05:47:14 +02:00
|
|
|
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxMathEnd').'/ contains=@NoSpell'
|
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
|
2019-12-21 04:41:03 +01:00
|
|
|
if vimwiki#vars#get_global('valid_html_tags') !=? ''
|
2020-08-04 00:45:46 +02:00
|
|
|
" Include: Source html file here
|
2020-08-02 09:51:25 +02:00
|
|
|
execute 'source ' . expand('<sfile>:h') . '/vimwiki_html.vim'
|
2012-06-07 02:00:00 +02:00
|
|
|
endif
|
2015-01-04 23:44:24 +01:00
|
|
|
|
2020-08-02 09:51:25 +02:00
|
|
|
|
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
|
|
|
|
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...
|
2019-12-21 04:41:03 +01:00
|
|
|
if !exists('g:colors_name')
|
2012-06-07 02:00:00 +02:00
|
|
|
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='
|
2019-12-21 04:41:03 +01:00
|
|
|
\ .vimwiki#vars#get_global('hcolor_guifg_'.&background)[s:i-1].' gui=bold ctermfg='
|
|
|
|
\ .vimwiki#vars#get_global('hcolor_ctermfg_'.&background)[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
|
|
|
|
2020-08-04 00:45:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
" Highlight Typefaces -> u.vim
|
|
|
|
let s:typeface_dic = vimwiki#vars#get_syntaxlocal('dTypeface')
|
|
|
|
call vimwiki#u#hi_typeface(s:typeface_dic)
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2011-06-11 02:00:00 +02:00
|
|
|
hi def link VimwikiMarkers Normal
|
2020-08-03 07:00:14 +02:00
|
|
|
hi def link VimwikiError 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
|
|
|
|
|
2020-08-02 04:28:32 +02:00
|
|
|
" Typeface 1
|
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
|
|
|
|
|
2020-08-02 04:28:32 +02:00
|
|
|
hi def VimwikiUnderline term=underline cterm=underline gui=underline
|
|
|
|
|
|
|
|
" Typeface 2
|
|
|
|
" Bold > Italic > Underline
|
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
|
|
|
|
|
2020-08-02 04:28:32 +02:00
|
|
|
hi def VimwikiBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline
|
|
|
|
hi def link VimwikiUnderlineBold VimwikiBoldUnderline
|
|
|
|
|
|
|
|
hi def VimwikiItalicUnderline term=italic,underline cterm=italic,underline gui=italic,underline
|
|
|
|
hi def link VimwikiUnderlineItalic VimwikiItalicUnderline
|
|
|
|
|
|
|
|
" Typeface 3
|
|
|
|
hi def VimwikiItalicUnderline term=italic,underline cterm=italic,underline gui=italic,underline
|
|
|
|
hi def link VimwikiBoldUnderlineItalic VimwikiBoldItalicUnderline
|
|
|
|
hi def link VimwikiItalicBoldUnderline VimwikiBoldItalicUnderline
|
|
|
|
hi def link VimwikiItalicUnderlineBold VimwikiBoldItalicUnderline
|
|
|
|
hi def link VimwikiUnderlineBoldItalic VimwikiBoldItalicUnderline
|
|
|
|
hi def link VimwikiUnderlineItalicBold VimwikiBoldItalicUnderline
|
|
|
|
|
|
|
|
" Typeface 2
|
|
|
|
hi def VimwikiBoldUnderlineItalic term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2020-08-04 00:45:46 +02:00
|
|
|
" Code
|
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
|
2019-03-28 22:49:42 +01:00
|
|
|
hi def link VimwikiPreDelim VimwikiPre
|
2010-08-24 02:00:00 +02:00
|
|
|
|
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
|
|
|
|
2020-08-04 00:45:46 +02:00
|
|
|
|
|
|
|
" Deleted called strikethrough
|
|
|
|
" See $VIMRUTIME/syntax/html.vim
|
|
|
|
if v:version > 800 || v:version == 800 && has('patch1038')
|
|
|
|
hi def VimwikiDelText term=strikethrough cterm=strikethrough gui=strikethrough
|
|
|
|
else
|
|
|
|
hi def link VimwikiDelText Constant
|
|
|
|
endif
|
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
|
2020-08-01 07:12:21 +02:00
|
|
|
hi def link VimwikiMultilineComment 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
|
|
|
|
2020-08-04 00:45:46 +02:00
|
|
|
" TODO remove unsued due to region refactoring
|
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"
|
2019-12-21 04:41:03 +01:00
|
|
|
let b:current_syntax='vimwiki'
|
2010-01-20 01:00:00 +01:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2020-08-04 00:45:46 +02:00
|
|
|
" Include: Code: EMBEDDED syntax setup -> base.vim
|
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')
|
2019-12-21 04:41:03 +01: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
|
2019-05-09 04:55:56 +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
|