Version 2.0.stu
This release is partly incompatible with 1.2. You should delete previous version of vimwiki before install. = Summary = * Quick page-link creation. * Redesign of link syntaxes (!) * No more CamelCase links. Check the ways to convert them http://goo.gl/15ctX * No more [[link][desc]] links. * No more [http://link description] links. * No more plain image links. Use transclusions. * No more image links identified by extension. Use transclusions. * Interwiki links. * Link schemes. * Transclusions. * Normalize link command. * Improved diary organization and generation. * List manipulation. * Markdown support. * Mathjax support. * Improved handling of special characters and punctuation in filenames and urls. * Back links command: list links referring to the current page. * Highlighting nonexisted links are off by default. * Table syntax change. Row separator uses | instead of +. * Fold multilined list items. * Custom wiki to HTML converters. * Conceal long weblinks. * Option to disable table mappings. For detailed information see issues list on http://code.google.com/p/vimwiki/issues/list
This commit is contained in:
@ -9,30 +9,331 @@ if version < 600
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
"TODO do nothing if ...? (?)
|
||||
let starttime = reltime() " start the clock
|
||||
if VimwikiGet('maxhi')
|
||||
let b:existing_wikifiles = vimwiki#base#get_links('*'.VimwikiGet('ext'))
|
||||
let b:existing_wikidirs = vimwiki#base#get_links('*/')
|
||||
endif
|
||||
let timescans = vimwiki#u#time(starttime) "XXX
|
||||
"let b:xxx = 1
|
||||
"TODO ? update wikilink syntax group here if really needed (?) for :e and such
|
||||
"if VimwikiGet('maxhi')
|
||||
" ...
|
||||
"endif
|
||||
|
||||
" Links highlighting is controlled by vimwiki#base#highlight_links() function.
|
||||
" It is called from setup_buffer_enter() function in the BufEnter autocommand.
|
||||
" LINKS: assume this is common to all syntaxes "{{{
|
||||
|
||||
" Load concrete Wiki syntax
|
||||
" LINKS: WebLinks {{{
|
||||
" match URL for common protocols;
|
||||
" see http://en.wikipedia.org/wiki/URI_scheme http://tools.ietf.org/html/rfc3986
|
||||
let g:vimwiki_rxWebProtocols = ''.
|
||||
\ '\%('.
|
||||
\ '\%('.
|
||||
\ '\%('.join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').'\):'.
|
||||
\ '\%(//\)'.
|
||||
\ '\)'.
|
||||
\ '\|'.
|
||||
\ '\%('.join(split(g:vimwiki_web_schemes2, '\s*,\s*'), '\|').'\):'.
|
||||
\ '\)'
|
||||
"
|
||||
let g:vimwiki_rxWeblinkUrl = g:vimwiki_rxWebProtocols .
|
||||
\ '\S\{-1,}'. '\%(([^ \t()]*)\)\='
|
||||
" }}}
|
||||
|
||||
" }}}
|
||||
|
||||
" -------------------------------------------------------------------------
|
||||
" Load concrete Wiki syntax: sets regexes and templates for headers and links
|
||||
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'.vim'
|
||||
" -------------------------------------------------------------------------
|
||||
let time0 = vimwiki#u#time(starttime) "XXX
|
||||
|
||||
" Concealed chars
|
||||
|
||||
" LINKS: setup of larger regexes {{{
|
||||
|
||||
" LINKS: setup wikilink regexps {{{
|
||||
let g:vimwiki_rxWikiLinkPrefix = '[['
|
||||
let g:vimwiki_rxWikiLinkSuffix = ']]'
|
||||
let g:vimwiki_rxWikiLinkSeparator = '|'
|
||||
" [[URL]]
|
||||
let g:vimwiki_WikiLinkTemplate1 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLinkSuffix
|
||||
" [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_WikiLinkTemplate2 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLinkSeparator. '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWikiLinkSuffix
|
||||
"
|
||||
let magic_chars = '.*[]\^$'
|
||||
let valid_chars = '[^\\]'
|
||||
|
||||
let g:vimwiki_rxWikiLinkPrefix = escape(g:vimwiki_rxWikiLinkPrefix, magic_chars)
|
||||
let g:vimwiki_rxWikiLinkSuffix = escape(g:vimwiki_rxWikiLinkSuffix, magic_chars)
|
||||
let g:vimwiki_rxWikiLinkSeparator = escape(g:vimwiki_rxWikiLinkSeparator, magic_chars)
|
||||
let g:vimwiki_rxWikiLinkUrl = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiLinkDescr = valid_chars.'\{-}'
|
||||
|
||||
let g:vimwiki_rxWord = '[^[:blank:]()\\]\+'
|
||||
|
||||
"
|
||||
" [[URL]], or [[URL|DESCRIPTION]]
|
||||
" a) match [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_rxWikiLink = g:vimwiki_rxWikiLinkPrefix.
|
||||
\ g:vimwiki_rxWikiLinkUrl.'\%('.g:vimwiki_rxWikiLinkSeparator.
|
||||
\ g:vimwiki_rxWikiLinkDescr.'\)\?'.g:vimwiki_rxWikiLinkSuffix
|
||||
" b) match URL within [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_rxWikiLinkMatchUrl = g:vimwiki_rxWikiLinkPrefix.
|
||||
\ '\zs'. g:vimwiki_rxWikiLinkUrl.'\ze\%('. g:vimwiki_rxWikiLinkSeparator.
|
||||
\ g:vimwiki_rxWikiLinkDescr.'\)\?'.g:vimwiki_rxWikiLinkSuffix
|
||||
" c) match DESCRIPTION within [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_rxWikiLinkMatchDescr = g:vimwiki_rxWikiLinkPrefix.
|
||||
\ g:vimwiki_rxWikiLinkUrl.g:vimwiki_rxWikiLinkSeparator.'\%('.
|
||||
\ '\zs'. g:vimwiki_rxWikiLinkDescr. '\ze\)\?'. g:vimwiki_rxWikiLinkSuffix
|
||||
" }}}
|
||||
|
||||
" LINKS: Syntax helper {{{
|
||||
let g:vimwiki_rxWikiLinkPrefix1 = g:vimwiki_rxWikiLinkPrefix.
|
||||
\ g:vimwiki_rxWikiLinkUrl.g:vimwiki_rxWikiLinkSeparator
|
||||
let g:vimwiki_rxWikiLinkSuffix1 = g:vimwiki_rxWikiLinkSuffix
|
||||
" }}}
|
||||
|
||||
|
||||
" LINKS: setup of wikiincl regexps {{{
|
||||
let g:vimwiki_rxWikiInclPrefix = '{{'
|
||||
let g:vimwiki_rxWikiInclSuffix = '}}'
|
||||
let g:vimwiki_rxWikiInclSeparator = '|'
|
||||
"
|
||||
" '{{__LinkUrl__}}'
|
||||
let g:vimwiki_WikiInclTemplate1 = g:vimwiki_rxWikiInclPrefix . '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiInclSuffix
|
||||
" '{{__LinkUrl____LinkDescription__}}'
|
||||
let g:vimwiki_WikiInclTemplate2 = g:vimwiki_rxWikiInclPrefix . '__LinkUrl__'.
|
||||
\ '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWikiInclSuffix
|
||||
|
||||
let g:vimwiki_rxWikiInclPrefix = escape(g:vimwiki_rxWikiInclPrefix, magic_chars)
|
||||
let g:vimwiki_rxWikiInclSuffix = escape(g:vimwiki_rxWikiInclSuffix, magic_chars)
|
||||
let g:vimwiki_rxWikiInclSeparator = escape(g:vimwiki_rxWikiInclSeparator, magic_chars)
|
||||
let g:vimwiki_rxWikiInclUrl = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiInclArg = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiInclArgs = '\%('. g:vimwiki_rxWikiInclSeparator. g:vimwiki_rxWikiInclArg. '\)'.'\{-}'
|
||||
"
|
||||
"
|
||||
" *. {{URL}[{...}]} - i.e. {{URL}}, {{URL|ARG1}}, {{URL|ARG1|ARG2}}, etc.
|
||||
" *a) match {{URL}[{...}]}
|
||||
let g:vimwiki_rxWikiIncl = g:vimwiki_rxWikiInclPrefix.
|
||||
\ g:vimwiki_rxWikiInclUrl.
|
||||
\ g:vimwiki_rxWikiInclArgs. g:vimwiki_rxWikiInclSuffix
|
||||
" *b) match URL within {{URL}[{...}]}
|
||||
let g:vimwiki_rxWikiInclMatchUrl = g:vimwiki_rxWikiInclPrefix.
|
||||
\ '\zs'. g:vimwiki_rxWikiInclUrl. '\ze'.
|
||||
\ g:vimwiki_rxWikiInclArgs. g:vimwiki_rxWikiInclSuffix
|
||||
" }}}
|
||||
|
||||
" LINKS: Syntax helper {{{
|
||||
let g:vimwiki_rxWikiInclPrefix1 = g:vimwiki_rxWikiInclPrefix.
|
||||
\ g:vimwiki_rxWikiInclUrl.g:vimwiki_rxWikiInclSeparator
|
||||
let g:vimwiki_rxWikiInclSuffix1 = g:vimwiki_rxWikiInclArgs.
|
||||
\ g:vimwiki_rxWikiInclSuffix
|
||||
" }}}
|
||||
|
||||
" LINKS: Setup weblink regexps {{{
|
||||
" 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L))
|
||||
" let g:vimwiki_rxWeblink = '[\["(|]\@<!'. g:vimwiki_rxWeblinkUrl .
|
||||
" \ '\%([),:;.!?]\=\%([ \t]\|$\)\)\@='
|
||||
" Maxim:
|
||||
" Simplify free-standing links: URL starts with non(letter|digit)scheme till
|
||||
" the whitespace.
|
||||
" Stuart, could you check it with markdown templated links? [](http://...), as
|
||||
" the last bracket is the part of URL now?
|
||||
let g:vimwiki_rxWeblink = '[[:alnum:]]\@<!'. g:vimwiki_rxWeblinkUrl . '\S*'
|
||||
" 0a) match URL within URL
|
||||
let g:vimwiki_rxWeblinkMatchUrl = g:vimwiki_rxWeblink
|
||||
" 0b) match DESCRIPTION within URL
|
||||
let g:vimwiki_rxWeblinkMatchDescr = ''
|
||||
" }}}
|
||||
|
||||
|
||||
" LINKS: Setup anylink regexps {{{
|
||||
let g:vimwiki_rxAnyLink = g:vimwiki_rxWikiLink.'\|'.
|
||||
\ g:vimwiki_rxWikiIncl.'\|'.g:vimwiki_rxWeblink
|
||||
" }}}
|
||||
|
||||
|
||||
" }}} end of Links
|
||||
|
||||
" LINKS: highlighting is complicated due to "nonexistent" links feature {{{
|
||||
function! s:add_target_syntax_ON(target, type) " {{{
|
||||
if g:vimwiki_debug > 1
|
||||
echom '[vimwiki_debug] syntax target > '.a:target
|
||||
endif
|
||||
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
|
||||
endfunction "}}}
|
||||
|
||||
function! s:add_target_syntax_OFF(target) " {{{
|
||||
if g:vimwiki_debug > 1
|
||||
echom '[vimwiki_debug] syntax target > '.a:target
|
||||
endif
|
||||
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
|
||||
endfunction "}}}
|
||||
|
||||
function! s:highlight_existing_links() "{{{
|
||||
" 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/...)
|
||||
let safe_links = vimwiki#base#file_pattern(b:existing_wikifiles)
|
||||
" Wikilink Dirs set up upon BufEnter (see plugin/...)
|
||||
let safe_dirs = vimwiki#base#file_pattern(b:existing_wikidirs)
|
||||
|
||||
" match [[URL]]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate1,
|
||||
\ safe_links, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" match [[URL|DESCRIPTION]]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate2,
|
||||
\ safe_links, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
|
||||
" match {{URL}}
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiInclTemplate1,
|
||||
\ safe_links, g:vimwiki_rxWikiInclArgs, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" match {{URL|...}}
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiInclTemplate2,
|
||||
\ safe_links, g:vimwiki_rxWikiInclArgs, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" match [[DIRURL]]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate1,
|
||||
\ safe_dirs, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" match [[DIRURL|DESCRIPTION]]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate2,
|
||||
\ safe_dirs, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
endfunction "}}}
|
||||
|
||||
|
||||
" use max highlighting - could be quite slow if there are too many wikifiles
|
||||
if VimwikiGet('maxhi')
|
||||
" WikiLink
|
||||
call s:add_target_syntax_OFF(g:vimwiki_rxWikiLink)
|
||||
" WikiIncl
|
||||
call s:add_target_syntax_OFF(g:vimwiki_rxWikiIncl)
|
||||
|
||||
" Subsequently, links verified on vimwiki's path are highlighted as existing
|
||||
let time01 = vimwiki#u#time(starttime) "XXX
|
||||
call s:highlight_existing_links()
|
||||
let time02 = vimwiki#u#time(starttime) "XXX
|
||||
else
|
||||
let time01 = vimwiki#u#time(starttime) "XXX
|
||||
" Wikilink
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWikiLink, 'VimwikiLink')
|
||||
" WikiIncl
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWikiIncl, 'VimwikiLink')
|
||||
let time02 = vimwiki#u#time(starttime) "XXX
|
||||
endif
|
||||
|
||||
" Weblink
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWeblink, 'VimwikiLink')
|
||||
|
||||
" WikiLink
|
||||
" All remaining schemes are highlighted automatically
|
||||
let rxSchemes = '\%('.
|
||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').
|
||||
\ '\):'
|
||||
|
||||
" a) match [[nonwiki-scheme-URL]]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate1,
|
||||
\ rxSchemes.g:vimwiki_rxWikiLinkUrl, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" b) match [[nonwiki-scheme-URL|DESCRIPTION]]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate2,
|
||||
\ rxSchemes.g:vimwiki_rxWikiLinkUrl, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
|
||||
" a) match {{nonwiki-scheme-URL}}
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiInclTemplate1,
|
||||
\ rxSchemes.g:vimwiki_rxWikiInclUrl, g:vimwiki_rxWikiInclArgs, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
" b) match {{nonwiki-scheme-URL}[{...}]}
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiInclTemplate2,
|
||||
\ rxSchemes.g:vimwiki_rxWikiInclUrl, g:vimwiki_rxWikiInclArgs, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
|
||||
" }}}
|
||||
|
||||
|
||||
" generic headers "{{{
|
||||
if g:vimwiki_symH
|
||||
"" symmetric
|
||||
for i in range(1,6)
|
||||
let g:vimwiki_rxH{i}_Template = repeat(g:vimwiki_rxH, i).' __Header__ '.repeat(g:vimwiki_rxH, i)
|
||||
let g:vimwiki_rxH{i} = '^\s*'.g:vimwiki_rxH.'\{'.i.'}[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']'.g:vimwiki_rxH.'\{'.i.'}\s*$'
|
||||
endfor
|
||||
let g:vimwiki_rxHeader = '^\s*\('.g:vimwiki_rxH.'\{1,6}\)\zs[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']\ze\1\s*$'
|
||||
else
|
||||
" asymmetric
|
||||
for i in range(1,6)
|
||||
let g:vimwiki_rxH{i}_Template = repeat(g:vimwiki_rxH, i).' __Header__'
|
||||
let g:vimwiki_rxH{i} = '^\s*'.g:vimwiki_rxH.'\{'.i.'}[^'.g:vimwiki_rxH.'].*$'
|
||||
endfor
|
||||
let g:vimwiki_rxHeader = '^\s*\('.g:vimwiki_rxH.'\{1,6}\)\zs[^'.g:vimwiki_rxH.'].*\ze$'
|
||||
endif
|
||||
|
||||
" Header levels, 1-6
|
||||
for i in range(1,6)
|
||||
execute 'syntax match VimwikiHeader'.i.' /'.g:vimwiki_rxH{i}.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,VimwikiLink,@Spell'
|
||||
endfor
|
||||
|
||||
" }}}
|
||||
|
||||
" concealed chars " {{{
|
||||
if exists("+conceallevel")
|
||||
syntax conceal on
|
||||
endif
|
||||
|
||||
syntax spell toplevel
|
||||
|
||||
syn match VimwikiLinkChar contained /\[\[/
|
||||
syn match VimwikiLinkChar contained /\]\]/
|
||||
syn match VimwikiLinkChar contained /\[\[[^\[\]\|]\{-}|\ze.\{-}]]/
|
||||
syn match VimwikiLinkChar contained /\[\[[^\[\]\|]\{-}]\[\ze.\{-}]]/
|
||||
if g:vimwiki_debug > 1
|
||||
echom 'WikiLink Prefix: '.g:vimwiki_rxWikiLinkPrefix1
|
||||
echom 'WikiLink Suffix: '.g:vimwiki_rxWikiLinkSuffix1
|
||||
echom 'WikiIncl Prefix: '.g:vimwiki_rxWikiInclPrefix1
|
||||
echom 'WikiIncl Suffix: '.g:vimwiki_rxWikiInclSuffix1
|
||||
endif
|
||||
|
||||
syn match VimwikiNoLinkChar contained /\[\[/
|
||||
syn match VimwikiNoLinkChar contained /\]\]/
|
||||
syn match VimwikiNoLinkChar contained /\[\[[^\[\]\|]\{-}|\ze.*]]/
|
||||
syn match VimwikiNoLinkChar contained /\[\[[^\[\]\|]\{-}]\[\ze.*]]/
|
||||
" VimwikiLinkChar is for syntax markers (and also URL when a description
|
||||
" is present) and may be concealed
|
||||
let options = ' contained transparent contains=NONE'
|
||||
" conceal wikilinks
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkPrefix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkSuffix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkPrefix1.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkSuffix1.'/'.options
|
||||
|
||||
" conceal wikiincls
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclPrefix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclSuffix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclPrefix1.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclSuffix1.'/'.options
|
||||
|
||||
" A shortener for long URLs: LinkRest (a middle part of the URL) is concealed
|
||||
execute 'syn match VimwikiLinkRest contained `\%(///\=[^/ \t]\+/\)\zs\S\{'
|
||||
\.g:vimwiki_url_mingain.',}\ze\%([/#?]\w\|\S\{'
|
||||
\.g:vimwiki_url_maxsave.'}\)` cchar=~ '.options
|
||||
|
||||
execute 'syn match VimwikiEqInChar contained /'.g:vimwiki_char_eqin.'/'
|
||||
execute 'syn match VimwikiBoldChar contained /'.g:vimwiki_char_bold.'/'
|
||||
execute 'syn match VimwikiItalicChar contained /'.g:vimwiki_char_italic.'/'
|
||||
execute 'syn match VimwikiBoldItalicChar contained /'.g:vimwiki_char_bolditalic.'/'
|
||||
@ -44,9 +345,11 @@ execute 'syn match VimwikiSubScript contained /'.g:vimwiki_char_subscript.'/'
|
||||
if exists("+conceallevel")
|
||||
syntax conceal off
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" Non concealed chars
|
||||
syn match VimwikiHeaderChar contained /\%(^\s*=\+\)\|\%(=\+\s*$\)/
|
||||
" non concealed chars " {{{
|
||||
execute 'syn match VimwikiHeaderChar contained /\%(^\s*'.g:vimwiki_rxH.'\+\)\|\%('.g:vimwiki_rxH.'\+\s*$\)/'
|
||||
execute 'syn match VimwikiEqInCharT contained /'.g:vimwiki_char_eqin.'/'
|
||||
execute 'syn match VimwikiBoldCharT contained /'.g:vimwiki_char_bold.'/'
|
||||
execute 'syn match VimwikiItalicCharT contained /'.g:vimwiki_char_italic.'/'
|
||||
execute 'syn match VimwikiBoldItalicCharT contained /'.g:vimwiki_char_bolditalic.'/'
|
||||
@ -56,21 +359,32 @@ execute 'syn match VimwikiDelTextCharT contained /'.g:vimwiki_char_deltext.'/'
|
||||
execute 'syn match VimwikiSuperScriptT contained /'.g:vimwiki_char_superscript.'/'
|
||||
execute 'syn match VimwikiSubScriptT contained /'.g:vimwiki_char_subscript.'/'
|
||||
|
||||
|
||||
" Emoticons
|
||||
syntax match VimwikiEmoticons /\%((.)\|:[()|$@]\|:-[DOPS()\]|$@]\|;)\|:'(\)/
|
||||
"syntax match VimwikiEmoticons /\%((.)\|:[()|$@]\|:-[DOPS()\]|$@]\|;)\|:'(\)/
|
||||
|
||||
let g:vimwiki_rxTodo = '\C\%(TODO:\|DONE:\|STARTED:\|FIXME:\|FIXED:\|XXX:\)'
|
||||
execute 'syntax match VimwikiTodo /'. g:vimwiki_rxTodo .'/'
|
||||
" }}}
|
||||
|
||||
" main syntax groups {{{
|
||||
|
||||
" Tables
|
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
\ transparent contains=VimwikiCellSeparator,VimwikiLinkT,
|
||||
\ VimwikiNoExistsLinkT,VimwikiEmoticons,VimwikiTodo,
|
||||
\ VimwikiBoldT,VimwikiItalicT,VimwikiBoldItalicT,VimwikiItalicBoldT,
|
||||
\ VimwikiDelTextT,VimwikiSuperScriptT,VimwikiSubScriptT,VimwikiCodeT,
|
||||
\ @Spell
|
||||
\ transparent contains=VimwikiCellSeparator,
|
||||
\ VimwikiLinkT,
|
||||
\ VimwikiNoExistsLinkT,
|
||||
\ VimwikiEmoticons,
|
||||
\ VimwikiTodo,
|
||||
\ VimwikiBoldT,
|
||||
\ VimwikiItalicT,
|
||||
\ VimwikiBoldItalicT,
|
||||
\ VimwikiItalicBoldT,
|
||||
\ VimwikiDelTextT,
|
||||
\ VimwikiSuperScriptT,
|
||||
\ VimwikiSubScriptT,
|
||||
\ VimwikiCodeT,
|
||||
\ VimwikiEqInT,
|
||||
\ @Spell
|
||||
syntax match VimwikiCellSeparator
|
||||
\ /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
||||
|
||||
@ -78,6 +392,23 @@ syntax match VimwikiCellSeparator
|
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListBullet.'/'
|
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListNumber.'/'
|
||||
execute 'syntax match VimwikiList /'.g:vimwiki_rxListDefine.'/'
|
||||
" List item checkbox
|
||||
"syntax match VimwikiCheckBox /\[.\?\]/
|
||||
let g:vimwiki_rxCheckBox = '\s*\[['.g:vimwiki_listsyms.']\?\]\s'
|
||||
" Todo lists have a checkbox
|
||||
execute 'syntax match VimwikiListTodo /'.g:vimwiki_rxListBullet.g:vimwiki_rxCheckBox.'/'
|
||||
execute 'syntax match VimwikiListTodo /'.g:vimwiki_rxListNumber.g:vimwiki_rxCheckBox.'/'
|
||||
if g:vimwiki_hl_cb_checked
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.
|
||||
\ g:vimwiki_rxListBullet.'\s*\['.g:vimwiki_listsyms[4].'\]\s.*$/'.
|
||||
\ ' contains=VimwikiNoExistsLink,VimwikiLink'
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.
|
||||
\ g:vimwiki_rxListNumber.'\s*\['.g:vimwiki_listsyms[4].'\]\s.*$/'.
|
||||
\ ' contains=VimwikiNoExistsLink,VimwikiLink'
|
||||
endif
|
||||
|
||||
execute 'syntax match VimwikiEqIn /'.g:vimwiki_rxEqIn.'/ contains=VimwikiEqInChar'
|
||||
execute 'syntax match VimwikiEqInT /'.g:vimwiki_rxEqIn.'/ contained contains=VimwikiEqInCharT'
|
||||
|
||||
execute 'syntax match VimwikiBold /'.g:vimwiki_rxBold.'/ contains=VimwikiBoldChar,@Spell'
|
||||
execute 'syntax match VimwikiBoldT /'.g:vimwiki_rxBold.'/ contained contains=VimwikiBoldCharT,@Spell'
|
||||
@ -103,23 +434,15 @@ execute 'syntax match VimwikiSubScriptT /'.g:vimwiki_rxSubScript.'/ contained co
|
||||
execute 'syntax match VimwikiCode /'.g:vimwiki_rxCode.'/ contains=VimwikiCodeChar'
|
||||
execute 'syntax match VimwikiCodeT /'.g:vimwiki_rxCode.'/ contained contains=VimwikiCodeCharT'
|
||||
|
||||
|
||||
" <hr> horizontal rule
|
||||
execute 'syntax match VimwikiHR /'.g:vimwiki_rxHR.'/'
|
||||
|
||||
execute 'syntax region VimwikiPre start=/^\s*'.g:vimwiki_rxPreStart.
|
||||
\ '/ end=/^\s*'.g:vimwiki_rxPreEnd.'\s*$/ contains=@Spell'
|
||||
|
||||
" List item checkbox
|
||||
syntax match VimwikiCheckBox /\[.\?\]/
|
||||
if g:vimwiki_hl_cb_checked
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.
|
||||
\ g:vimwiki_rxListBullet.'\s*\['.g:vimwiki_listsyms[4].'\].*$/'.
|
||||
\ ' contains=VimwikiNoExistsLink,VimwikiLink'
|
||||
execute 'syntax match VimwikiCheckBoxDone /'.
|
||||
\ g:vimwiki_rxListNumber.'\s*\['.g:vimwiki_listsyms[4].'\].*$/'.
|
||||
\ ' contains=VimwikiNoExistsLink,VimwikiLink'
|
||||
endif
|
||||
execute 'syntax region VimwikiMath start=/^\s*'.g:vimwiki_rxMathStart.
|
||||
\ '/ end=/^\s*'.g:vimwiki_rxMathEnd.'\s*$/ contains=@Spell'
|
||||
|
||||
|
||||
" placeholders
|
||||
syntax match VimwikiPlaceholder /^\s*%toc\%(\s.*\)\?$/ contains=VimwikiPlaceholderParam
|
||||
@ -129,51 +452,48 @@ syntax match VimwikiPlaceholder /^\s*%template\%(\s.*\)\?$/ contains=VimwikiPlac
|
||||
syntax match VimwikiPlaceholderParam /\s.*/ contained
|
||||
|
||||
" html tags
|
||||
let html_tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|')
|
||||
exe 'syntax match VimwikiHTMLtag #\c</\?\%('.html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#'
|
||||
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'
|
||||
if g:vimwiki_valid_html_tags != ''
|
||||
let html_tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|')
|
||||
exe 'syntax match VimwikiHTMLtag #\c</\?\%('.html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#'
|
||||
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'
|
||||
|
||||
execute 'syntax match VimwikiComment /'.g:vimwiki_rxComment.'/ contains=@Spell'
|
||||
execute 'syntax match VimwikiComment /'.g:vimwiki_rxComment.'/ contains=@Spell'
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" Header levels, 1-6
|
||||
execute 'syntax match VimwikiHeader1 /'.g:vimwiki_rxH1.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
execute 'syntax match VimwikiHeader2 /'.g:vimwiki_rxH2.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
execute 'syntax match VimwikiHeader3 /'.g:vimwiki_rxH3.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
execute 'syntax match VimwikiHeader4 /'.g:vimwiki_rxH4.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
execute 'syntax match VimwikiHeader5 /'.g:vimwiki_rxH5.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
execute 'syntax match VimwikiHeader6 /'.g:vimwiki_rxH6.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiLink,@Spell'
|
||||
|
||||
" group names "{{{
|
||||
" header groups highlighting "{{{
|
||||
|
||||
if g:vimwiki_hl_headers == 0
|
||||
hi link VimwikiHeader1 Title
|
||||
hi link VimwikiHeader2 Title
|
||||
hi link VimwikiHeader3 Title
|
||||
hi link VimwikiHeader4 Title
|
||||
hi link VimwikiHeader5 Title
|
||||
hi link VimwikiHeader6 Title
|
||||
else
|
||||
if &background == 'light'
|
||||
hi def VimwikiHeader1 guibg=bg guifg=#aa5858 gui=bold ctermfg=DarkRed term=bold cterm=bold
|
||||
hi def VimwikiHeader2 guibg=bg guifg=#507030 gui=bold ctermfg=DarkGreen term=bold cterm=bold
|
||||
hi def VimwikiHeader3 guibg=bg guifg=#1030a0 gui=bold ctermfg=DarkBlue term=bold cterm=bold
|
||||
hi def VimwikiHeader4 guibg=bg guifg=#103040 gui=bold ctermfg=Black term=bold cterm=bold
|
||||
hi def VimwikiHeader5 guibg=bg guifg=#505050 gui=bold ctermfg=Black term=bold cterm=bold
|
||||
hi def VimwikiHeader6 guibg=bg guifg=#636363 gui=bold ctermfg=Black term=bold cterm=bold
|
||||
else
|
||||
hi def VimwikiHeader1 guibg=bg guifg=#e08090 gui=bold ctermfg=Red term=bold cterm=bold
|
||||
hi def VimwikiHeader2 guibg=bg guifg=#80e090 gui=bold ctermfg=Green term=bold cterm=bold
|
||||
hi def VimwikiHeader3 guibg=bg guifg=#6090e0 gui=bold ctermfg=Blue term=bold cterm=bold
|
||||
hi def VimwikiHeader4 guibg=bg guifg=#c0c0f0 gui=bold ctermfg=White term=bold cterm=bold
|
||||
hi def VimwikiHeader5 guibg=bg guifg=#e0e0f0 gui=bold ctermfg=White term=bold cterm=bold
|
||||
hi def VimwikiHeader6 guibg=bg guifg=#f0f0f0 gui=bold ctermfg=White term=bold cterm=bold
|
||||
" Strangely in default colorscheme Title group is not set to bold for cterm...
|
||||
if !exists("g:colors_name")
|
||||
hi Title cterm=bold
|
||||
endif
|
||||
for i in range(1,6)
|
||||
execute 'hi def link VimwikiHeader'.i.' Title'
|
||||
endfor
|
||||
else
|
||||
" default colors when headers of different levels are highlighted differently
|
||||
" not making it yet another option; needed by ColorScheme autocommand
|
||||
let g:vimwiki_hcolor_guifg_light = ['#aa5858','#507030','#1030a0','#103040','#505050','#636363']
|
||||
let g:vimwiki_hcolor_ctermfg_light = ['DarkRed','DarkGreen','DarkBlue','Black','Black','Black']
|
||||
let g:vimwiki_hcolor_guifg_dark = ['#e08090','#80e090','#6090e0','#c0c0f0','#e0e0f0','#f0f0f0']
|
||||
let g:vimwiki_hcolor_ctermfg_dark = ['Red','Green','Blue','White','White','White']
|
||||
for i in range(1,6)
|
||||
execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='.g:vimwiki_hcolor_guifg_{&bg}[i-1].' gui=bold ctermfg='.g:vimwiki_hcolor_ctermfg_{&bg}[i-1].' term=bold cterm=bold'
|
||||
endfor
|
||||
endif
|
||||
"}}}
|
||||
|
||||
|
||||
" syntax group highlighting "{{{
|
||||
|
||||
hi def link VimwikiMarkers Normal
|
||||
|
||||
hi def link VimwikiEqIn Number
|
||||
hi def link VimwikiEqInT VimwikiEqIn
|
||||
|
||||
hi def VimwikiBold term=bold cterm=bold gui=bold
|
||||
hi def link VimwikiBoldT VimwikiBold
|
||||
|
||||
@ -193,6 +513,9 @@ hi def link VimwikiCodeT VimwikiCode
|
||||
hi def link VimwikiPre PreProc
|
||||
hi def link VimwikiPreT VimwikiPre
|
||||
|
||||
hi def link VimwikiMath Number
|
||||
hi def link VimwikiMathT VimwikiMath
|
||||
|
||||
hi def link VimwikiNoExistsLink SpellBad
|
||||
hi def link VimwikiNoExistsLinkT VimwikiNoExistsLink
|
||||
|
||||
@ -200,9 +523,11 @@ hi def link VimwikiLink Underlined
|
||||
hi def link VimwikiLinkT VimwikiLink
|
||||
|
||||
hi def link VimwikiList Identifier
|
||||
hi def link VimwikiCheckBox VimwikiList
|
||||
hi def link VimwikiListTodo VimwikiList
|
||||
"hi def link VimwikiCheckBox VimwikiList
|
||||
hi def link VimwikiCheckBoxDone Comment
|
||||
hi def link VimwikiEmoticons Character
|
||||
hi def link VimwikiHR Identifier
|
||||
|
||||
hi def link VimwikiDelText Constant
|
||||
hi def link VimwikiDelTextT VimwikiDelText
|
||||
@ -220,6 +545,7 @@ hi def link VimwikiPlaceholder SpecialKey
|
||||
hi def link VimwikiPlaceholderParam String
|
||||
hi def link VimwikiHTMLtag SpecialKey
|
||||
|
||||
hi def link VimwikiEqInChar VimwikiMarkers
|
||||
hi def link VimwikiCellSeparator VimwikiMarkers
|
||||
hi def link VimwikiBoldChar VimwikiMarkers
|
||||
hi def link VimwikiItalicChar VimwikiMarkers
|
||||
@ -230,9 +556,8 @@ hi def link VimwikiSuperScriptChar VimwikiMarkers
|
||||
hi def link VimwikiSubScriptChar VimwikiMarkers
|
||||
hi def link VimwikiCodeChar VimwikiMarkers
|
||||
hi def link VimwikiHeaderChar VimwikiMarkers
|
||||
hi def link VimwikiLinkChar VimwikiLink
|
||||
hi def link VimwikiNoLinkChar VimwikiNoExistsLink
|
||||
|
||||
hi def link VimwikiEqInCharT VimwikiMarkers
|
||||
hi def link VimwikiBoldCharT VimwikiMarkers
|
||||
hi def link VimwikiItalicCharT VimwikiMarkers
|
||||
hi def link VimwikiBoldItalicCharT VimwikiMarkers
|
||||
@ -243,9 +568,14 @@ hi def link VimwikiSubScriptCharT VimwikiMarkers
|
||||
hi def link VimwikiCodeCharT VimwikiMarkers
|
||||
hi def link VimwikiHeaderCharT VimwikiMarkers
|
||||
hi def link VimwikiLinkCharT VimwikiLinkT
|
||||
hi def link VimwikiNoLinkCharT VimwikiNoExistsLinkT
|
||||
hi def link VimwikiNoExistsLinkCharT VimwikiNoExistsLinkT
|
||||
"}}}
|
||||
|
||||
" -------------------------------------------------------------------------
|
||||
" Load syntax-specific functionality
|
||||
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'_custom.vim'
|
||||
" -------------------------------------------------------------------------
|
||||
|
||||
let b:current_syntax="vimwiki"
|
||||
|
||||
" EMBEDDED syntax setup "{{{
|
||||
@ -253,9 +583,16 @@ let nested = VimwikiGet('nested_syntaxes')
|
||||
if !empty(nested)
|
||||
for [hl_syntax, vim_syntax] in items(nested)
|
||||
call vimwiki#base#nested_syntax(vim_syntax,
|
||||
\ '^\s*{{{\%(.*[[:blank:][:punct:]]\)\?'.
|
||||
\ '^\s*'.g:vimwiki_rxPreStart.'\%(.*[[:blank:][:punct:]]\)\?'.
|
||||
\ hl_syntax.'\%([[:blank:][:punct:]].*\)\?',
|
||||
\ '^\s*}}}', 'VimwikiPre')
|
||||
\ '^\s*'.g:vimwiki_rxPreEnd, 'VimwikiPre')
|
||||
" call vimwiki#base#nested_syntax(vim_syntax,
|
||||
" \ '^\s*{{\$\%(.*[[:blank:][:punct:]]\)\?'.
|
||||
" \ hl_syntax.'\%([[:blank:][:punct:]].*\)\?',
|
||||
" \ '^\s*}}\$', 'VimwikiMath')
|
||||
endfor
|
||||
endif
|
||||
"}}}
|
||||
|
||||
let timeend = vimwiki#u#time(starttime) "XXX
|
||||
call VimwikiLog_extend('timing',['syntax:scans',timescans],['syntax:regexloaded',time0],['syntax:beforeHLexisting',time01],['syntax:afterHLexisting',time02],['syntax:end',timeend])
|
||||
|
@ -4,6 +4,13 @@
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" placeholder for math environments
|
||||
let b:vimwiki_mathEnv = ""
|
||||
|
||||
" text: $ equation_inline $
|
||||
let g:vimwiki_rxEqIn = '\$[^$`]\+\$'
|
||||
let g:vimwiki_char_eqin = '\$'
|
||||
|
||||
" text: *strong*
|
||||
" let g:vimwiki_rxBold = '\*[^*]\+\*'
|
||||
let g:vimwiki_rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
@ -53,27 +60,20 @@ let g:vimwiki_char_superscript = '^'
|
||||
let g:vimwiki_rxSubScript = ',,[^,`]\+,,'
|
||||
let g:vimwiki_char_subscript = ',,'
|
||||
|
||||
" Header levels, 1-6
|
||||
let g:vimwiki_rxH1 = '^\s*=\{1}[^=]\+.*[^=]\+=\{1}\s*$'
|
||||
let g:vimwiki_rxH2 = '^\s*=\{2}[^=]\+.*[^=]\+=\{2}\s*$'
|
||||
let g:vimwiki_rxH3 = '^\s*=\{3}[^=]\+.*[^=]\+=\{3}\s*$'
|
||||
let g:vimwiki_rxH4 = '^\s*=\{4}[^=]\+.*[^=]\+=\{4}\s*$'
|
||||
let g:vimwiki_rxH5 = '^\s*=\{5}[^=]\+.*[^=]\+=\{5}\s*$'
|
||||
let g:vimwiki_rxH6 = '^\s*=\{6}[^=]\+.*[^=]\+=\{6}\s*$'
|
||||
let g:vimwiki_rxHeader = '\%('.g:vimwiki_rxH1.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH2.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH3.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH4.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH5.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH6.'\)'
|
||||
" generic headers
|
||||
let g:vimwiki_rxH = '='
|
||||
let g:vimwiki_symH = 1
|
||||
|
||||
|
||||
let g:vimwiki_char_header = '\%(^\s*=\+\)\|\%(=\+\s*$\)'
|
||||
|
||||
" <hr>, horizontal rule
|
||||
let g:vimwiki_rxHR = '^----.*$'
|
||||
let g:vimwiki_rxHR = '^-----*$'
|
||||
|
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||
let g:vimwiki_rxTableSep = '|'
|
||||
|
||||
" List items start with optional whitespace(s) then '* ' or '# '
|
||||
let g:vimwiki_rxListBullet = '^\s*\%(\*\|-\)\s'
|
||||
let g:vimwiki_rxListBullet = '^\s*[*-]\s'
|
||||
let g:vimwiki_rxListNumber = '^\s*#\s'
|
||||
|
||||
let g:vimwiki_rxListDefine = '::\(\s\|$\)'
|
||||
@ -82,4 +82,8 @@ let g:vimwiki_rxListDefine = '::\(\s\|$\)'
|
||||
let g:vimwiki_rxPreStart = '{{{'
|
||||
let g:vimwiki_rxPreEnd = '}}}'
|
||||
|
||||
" Math block
|
||||
let g:vimwiki_rxMathStart = '{{\$'
|
||||
let g:vimwiki_rxMathEnd = '}}\$'
|
||||
|
||||
let g:vimwiki_rxComment = '^\s*%%.*$'
|
||||
|
89
syntax/vimwiki_markdown.vim
Normal file
89
syntax/vimwiki_markdown.vim
Normal file
@ -0,0 +1,89 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki syntax file
|
||||
" Default syntax
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" placeholder for math environments
|
||||
let b:vimwiki_mathEnv = ""
|
||||
|
||||
" text: $ equation_inline $
|
||||
let g:vimwiki_rxEqIn = '\$[^$`]\+\$'
|
||||
let g:vimwiki_char_eqin = '\$'
|
||||
|
||||
" text: *strong*
|
||||
" let g:vimwiki_rxBold = '\*[^*]\+\*'
|
||||
let g:vimwiki_rxBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'\*'.
|
||||
\'\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)'.
|
||||
\'\*'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let g:vimwiki_char_bold = '*'
|
||||
|
||||
" text: _emphasis_
|
||||
" let g:vimwiki_rxItalic = '_[^_]\+_'
|
||||
let g:vimwiki_rxItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'_'.
|
||||
\'\%([^_`[:space:]][^_`]*[^_`[:space:]]\|[^_`[:space:]]\)'.
|
||||
\'_'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let g:vimwiki_char_italic = '_'
|
||||
|
||||
" text: *_bold italic_* or _*italic bold*_
|
||||
let g:vimwiki_rxBoldItalic = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'\*_'.
|
||||
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
|
||||
\'_\*'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let g:vimwiki_char_bolditalic = '\*_'
|
||||
|
||||
let g:vimwiki_rxItalicBold = '\%(^\|\s\|[[:punct:]]\)\@<='.
|
||||
\'_\*'.
|
||||
\'\%([^*_`[:space:]][^*_`]*[^*_`[:space:]]\|[^*_`[:space:]]\)'.
|
||||
\'\*_'.
|
||||
\'\%([[:punct:]]\|\s\|$\)\@='
|
||||
let g:vimwiki_char_italicbold = '_\*'
|
||||
|
||||
" text: `code`
|
||||
let g:vimwiki_rxCode = '`[^`]\+`'
|
||||
let g:vimwiki_char_code = '`'
|
||||
|
||||
" text: ~~deleted text~~
|
||||
let g:vimwiki_rxDelText = '\~\~[^~`]\+\~\~'
|
||||
let g:vimwiki_char_deltext = '\~\~'
|
||||
|
||||
" text: ^superscript^
|
||||
let g:vimwiki_rxSuperScript = '\^[^^`]\+\^'
|
||||
let g:vimwiki_char_superscript = '^'
|
||||
|
||||
" text: ,,subscript,,
|
||||
let g:vimwiki_rxSubScript = ',,[^,`]\+,,'
|
||||
let g:vimwiki_char_subscript = ',,'
|
||||
|
||||
" generic headers
|
||||
let g:vimwiki_rxH = '#'
|
||||
let g:vimwiki_symH = 0
|
||||
|
||||
|
||||
|
||||
" <hr>, horizontal rule
|
||||
let g:vimwiki_rxHR = '^-----*$'
|
||||
|
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||
let g:vimwiki_rxTableSep = '|'
|
||||
|
||||
" List items start with optional whitespace(s) then '* ' or '1. ', '2. ', etc.
|
||||
let g:vimwiki_rxListBullet = '^\s*[*+-]\s'
|
||||
let g:vimwiki_rxListNumber = '^\s*[0-9]\+\.\s'
|
||||
|
||||
let g:vimwiki_rxListDefine = '::\%(\s\|$\)'
|
||||
|
||||
" Preformatted text
|
||||
let g:vimwiki_rxPreStart = '```'
|
||||
let g:vimwiki_rxPreEnd = '```'
|
||||
|
||||
" Math block
|
||||
let g:vimwiki_rxMathStart = '{{\$'
|
||||
let g:vimwiki_rxMathEnd = '}}\$'
|
||||
|
||||
let g:vimwiki_rxComment = '^\s*%%.*$'
|
367
syntax/vimwiki_markdown_custom.vim
Normal file
367
syntax/vimwiki_markdown_custom.vim
Normal file
@ -0,0 +1,367 @@
|
||||
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
|
||||
" Vimwiki syntax file
|
||||
" Author: Stuart Andrews <stu.andrews@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" LINKS: assume this is common to all syntaxes "{{{
|
||||
|
||||
" }}}
|
||||
|
||||
" -------------------------------------------------------------------------
|
||||
" Load concrete Wiki syntax: sets regexes and templates for headers and links
|
||||
|
||||
" -------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
" LINKS: setup of larger regexes {{{
|
||||
|
||||
" LINKS: setup wikilink0 regexps {{{
|
||||
" 0. [[URL]], or [[URL|DESCRIPTION]]
|
||||
|
||||
" 0a) match [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_rxWikiLink0 = g:vimwiki_rxWikiLink
|
||||
" 0b) match URL within [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_rxWikiLink0MatchUrl = g:vimwiki_rxWikiLinkMatchUrl
|
||||
" 0c) match DESCRIPTION within [[URL|DESCRIPTION]]
|
||||
let g:vimwiki_rxWikiLink0MatchDescr = g:vimwiki_rxWikiLinkMatchDescr
|
||||
" }}}
|
||||
|
||||
" LINKS: setup wikilink1 regexps {{{
|
||||
" 1. [URL][], or [DESCRIPTION][URL]
|
||||
|
||||
let g:vimwiki_rxWikiLink1Prefix = '['
|
||||
let g:vimwiki_rxWikiLink1Suffix = ']'
|
||||
let g:vimwiki_rxWikiLink1Separator = ']['
|
||||
|
||||
" [URL][]
|
||||
let g:vimwiki_WikiLink1Template1 = g:vimwiki_rxWikiLink1Prefix . '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLink1Separator. g:vimwiki_rxWikiLink1Suffix
|
||||
" [DESCRIPTION][URL]
|
||||
let g:vimwiki_WikiLink1Template2 = g:vimwiki_rxWikiLink1Prefix . '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWikiLink1Separator. '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLink1Suffix
|
||||
"
|
||||
let magic_chars = '.*[]\^$'
|
||||
let valid_chars = '[^\\\[\]]'
|
||||
|
||||
let g:vimwiki_rxWikiLink1Prefix = escape(g:vimwiki_rxWikiLink1Prefix, magic_chars)
|
||||
let g:vimwiki_rxWikiLink1Suffix = escape(g:vimwiki_rxWikiLink1Suffix, magic_chars)
|
||||
let g:vimwiki_rxWikiLink1Separator = escape(g:vimwiki_rxWikiLink1Separator, magic_chars)
|
||||
let g:vimwiki_rxWikiLink1Url = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiLink1Descr = valid_chars.'\{-}'
|
||||
|
||||
let g:vimwiki_rxWikiLink1InvalidPrefix = '[\]\[]\@<!'
|
||||
let g:vimwiki_rxWikiLink1InvalidSuffix = '[\]\[]\@!'
|
||||
let g:vimwiki_rxWikiLink1Prefix = g:vimwiki_rxWikiLink1InvalidPrefix.
|
||||
\ g:vimwiki_rxWikiLink1Prefix
|
||||
let g:vimwiki_rxWikiLink1Suffix = g:vimwiki_rxWikiLink1Suffix.
|
||||
\ g:vimwiki_rxWikiLink1InvalidSuffix
|
||||
|
||||
"
|
||||
" 1. [URL][], [DESCRIPTION][URL]
|
||||
" 1a) match [URL][], [DESCRIPTION][URL]
|
||||
let g:vimwiki_rxWikiLink1 = g:vimwiki_rxWikiLink1Prefix.
|
||||
\ g:vimwiki_rxWikiLink1Url. g:vimwiki_rxWikiLink1Separator.
|
||||
\ g:vimwiki_rxWikiLink1Suffix.
|
||||
\ '\|'. g:vimwiki_rxWikiLink1Prefix.
|
||||
\ g:vimwiki_rxWikiLink1Descr.g:vimwiki_rxWikiLink1Separator.
|
||||
\ g:vimwiki_rxWikiLink1Url.g:vimwiki_rxWikiLink1Suffix
|
||||
" 1b) match URL within [URL][], [DESCRIPTION][URL]
|
||||
let g:vimwiki_rxWikiLink1MatchUrl = g:vimwiki_rxWikiLink1Prefix.
|
||||
\ '\zs'. g:vimwiki_rxWikiLink1Url. '\ze'. g:vimwiki_rxWikiLink1Separator.
|
||||
\ g:vimwiki_rxWikiLink1Suffix.
|
||||
\ '\|'. g:vimwiki_rxWikiLink1Prefix.
|
||||
\ g:vimwiki_rxWikiLink1Descr. g:vimwiki_rxWikiLink1Separator.
|
||||
\ '\zs'. g:vimwiki_rxWikiLink1Url. '\ze'. g:vimwiki_rxWikiLink1Suffix
|
||||
" 1c) match DESCRIPTION within [DESCRIPTION][URL]
|
||||
let g:vimwiki_rxWikiLink1MatchDescr = g:vimwiki_rxWikiLink1Prefix.
|
||||
\ '\zs'. g:vimwiki_rxWikiLink1Descr.'\ze'. g:vimwiki_rxWikiLink1Separator.
|
||||
\ g:vimwiki_rxWikiLink1Url.g:vimwiki_rxWikiLink1Suffix
|
||||
" }}}
|
||||
|
||||
" LINKS: Syntax helper {{{
|
||||
let g:vimwiki_rxWikiLink1Prefix1 = g:vimwiki_rxWikiLink1Prefix
|
||||
let g:vimwiki_rxWikiLink1Suffix1 = g:vimwiki_rxWikiLink1Separator.
|
||||
\ g:vimwiki_rxWikiLink1Url.g:vimwiki_rxWikiLink1Suffix
|
||||
" }}}
|
||||
|
||||
" *. ANY wikilink {{{
|
||||
" *a) match ANY wikilink
|
||||
let g:vimwiki_rxWikiLink = ''.
|
||||
\ g:vimwiki_rxWikiLink0.'\|'.
|
||||
\ g:vimwiki_rxWikiLink1
|
||||
" *b) match URL within ANY wikilink
|
||||
let g:vimwiki_rxWikiLinkMatchUrl = ''.
|
||||
\ g:vimwiki_rxWikiLink0MatchUrl.'\|'.
|
||||
\ g:vimwiki_rxWikiLink1MatchUrl
|
||||
" *c) match DESCRIPTION within ANY wikilink
|
||||
let g:vimwiki_rxWikiLinkMatchDescr = ''.
|
||||
\ g:vimwiki_rxWikiLink0MatchDescr.'\|'.
|
||||
\ g:vimwiki_rxWikiLink1MatchDescr
|
||||
" }}}
|
||||
|
||||
|
||||
" LINKS: setup of wikiincl regexps {{{
|
||||
" }}}
|
||||
|
||||
" LINKS: Syntax helper {{{
|
||||
" }}}
|
||||
|
||||
" LINKS: Setup weblink0 regexps {{{
|
||||
" 0. URL : free-standing links: keep URL UR(L) strip trailing punct: URL; URL) UR(L))
|
||||
let g:vimwiki_rxWeblink0 = g:vimwiki_rxWeblink
|
||||
" 0a) match URL within URL
|
||||
let g:vimwiki_rxWeblinkMatchUrl0 = g:vimwiki_rxWeblinkMatchUrl
|
||||
" 0b) match DESCRIPTION within URL
|
||||
let g:vimwiki_rxWeblinkMatchDescr0 = g:vimwiki_rxWeblinkMatchDescr
|
||||
" }}}
|
||||
|
||||
" LINKS: Setup weblink1 regexps {{{
|
||||
let g:vimwiki_rxWeblink1Prefix = '['
|
||||
let g:vimwiki_rxWeblink1Suffix = ')'
|
||||
let g:vimwiki_rxWeblink1Separator = ']('
|
||||
" [DESCRIPTION](URL)
|
||||
let g:vimwiki_Weblink1Template = g:vimwiki_rxWeblink1Prefix . '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWeblink1Separator. '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWeblink1Suffix
|
||||
|
||||
let magic_chars = '.*[]\^$'
|
||||
let valid_chars = '[^\\]'
|
||||
|
||||
let g:vimwiki_rxWeblink1Prefix = escape(g:vimwiki_rxWeblink1Prefix, magic_chars)
|
||||
let g:vimwiki_rxWeblink1Suffix = escape(g:vimwiki_rxWeblink1Suffix, magic_chars)
|
||||
let g:vimwiki_rxWeblink1Separator = escape(g:vimwiki_rxWeblink1Separator, magic_chars)
|
||||
let g:vimwiki_rxWeblink1Url = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWeblink1Descr = valid_chars.'\{-}'
|
||||
|
||||
"
|
||||
" " 2012-02-04 TODO not starting with [[ or ][ ? ... prefix = '[\[\]]\@<!\['
|
||||
" 1. [DESCRIPTION](URL)
|
||||
" 1a) match [DESCRIPTION](URL)
|
||||
let g:vimwiki_rxWeblink1 = g:vimwiki_rxWeblink1Prefix.
|
||||
\ g:vimwiki_rxWeblink1Url.g:vimwiki_rxWeblink1Separator.
|
||||
\ g:vimwiki_rxWeblink1Descr.g:vimwiki_rxWeblink1Suffix
|
||||
" 1b) match URL within [DESCRIPTION](URL)
|
||||
let g:vimwiki_rxWeblink1MatchUrl = g:vimwiki_rxWeblink1Prefix.
|
||||
\ g:vimwiki_rxWeblink1Descr. g:vimwiki_rxWeblink1Separator.
|
||||
\ '\zs'.g:vimwiki_rxWeblink1Url.'\ze'. g:vimwiki_rxWeblink1Suffix
|
||||
" 1c) match DESCRIPTION within [DESCRIPTION](URL)
|
||||
let g:vimwiki_rxWeblink1MatchDescr = g:vimwiki_rxWeblink1Prefix.
|
||||
\ '\zs'.g:vimwiki_rxWeblink1Descr.'\ze'. g:vimwiki_rxWeblink1Separator.
|
||||
\ g:vimwiki_rxWeblink1Url. g:vimwiki_rxWeblink1Suffix
|
||||
" }}}
|
||||
|
||||
" Syntax helper {{{
|
||||
" TODO: image links too !!
|
||||
" let g:vimwiki_rxWeblink1Prefix1 = '!\?'. g:vimwiki_rxWeblink1Prefix
|
||||
let g:vimwiki_rxWeblink1Prefix1 = g:vimwiki_rxWeblink1Prefix
|
||||
let g:vimwiki_rxWeblink1Suffix1 = g:vimwiki_rxWeblink1Separator.
|
||||
\ g:vimwiki_rxWeblink1Url.g:vimwiki_rxWeblink1Suffix
|
||||
" }}}
|
||||
|
||||
" *. ANY weblink {{{
|
||||
" *a) match ANY weblink
|
||||
let g:vimwiki_rxWeblink = ''.
|
||||
\ g:vimwiki_rxWeblink1.'\|'.
|
||||
\ g:vimwiki_rxWeblink0
|
||||
" *b) match URL within ANY weblink
|
||||
let g:vimwiki_rxWeblinkMatchUrl = ''.
|
||||
\ g:vimwiki_rxWeblink1MatchUrl.'\|'.
|
||||
\ g:vimwiki_rxWeblinkMatchUrl0
|
||||
" *c) match DESCRIPTION within ANY weblink
|
||||
let g:vimwiki_rxWeblinkMatchDescr = ''.
|
||||
\ g:vimwiki_rxWeblink1MatchDescr.'\|'.
|
||||
\ g:vimwiki_rxWeblinkMatchDescr0
|
||||
" }}}
|
||||
|
||||
|
||||
" LINKS: Setup anylink regexps {{{
|
||||
let g:vimwiki_rxAnyLink = g:vimwiki_rxWikiLink.'\|'.
|
||||
\ g:vimwiki_rxWikiIncl.'\|'.g:vimwiki_rxWeblink
|
||||
" }}}
|
||||
|
||||
|
||||
" }}} end of Links
|
||||
|
||||
" LINKS: highlighting is complicated due to "nonexistent" links feature {{{
|
||||
function! s:add_target_syntax_ON(target, type) " {{{
|
||||
if g:vimwiki_debug > 1
|
||||
echom '[vimwiki_debug] syntax target > '.a:target
|
||||
endif
|
||||
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
|
||||
endfunction "}}}
|
||||
|
||||
function! s:add_target_syntax_OFF(target, type) " {{{
|
||||
if g:vimwiki_debug > 1
|
||||
echom '[vimwiki_debug] syntax target > '.a:target
|
||||
endif
|
||||
let prefix0 = 'syntax match VimwikiNoExistsLink `'
|
||||
let suffix0 = '` display contains=@NoSpell,VimwikiLinkRest,'.a:type.'Char'
|
||||
let prefix1 = 'syntax match VimwikiNoExistsLinkT `'
|
||||
let suffix1 = '` display contained'
|
||||
execute prefix0. a:target. suffix0
|
||||
execute prefix1. a:target. suffix1
|
||||
endfunction "}}}
|
||||
|
||||
function! s:wrap_wikilink1_rx(target) "{{{
|
||||
return g:vimwiki_rxWikiLink1InvalidPrefix.a:target.
|
||||
\ g:vimwiki_rxWikiLink1InvalidSuffix
|
||||
endfunction "}}}
|
||||
|
||||
function! s:highlight_existing_links() "{{{
|
||||
" Wikilink1
|
||||
" 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/...)
|
||||
let safe_links = vimwiki#base#file_pattern(b:existing_wikifiles)
|
||||
" Wikilink1 Dirs set up upon BufEnter (see plugin/...)
|
||||
let safe_dirs = vimwiki#base#file_pattern(b:existing_wikidirs)
|
||||
|
||||
" match [URL]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template1,
|
||||
\ safe_links, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
" match [DESCRIPTION][URL]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template2,
|
||||
\ safe_links, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
|
||||
" match [DIRURL]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template1,
|
||||
\ safe_dirs, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
" match [DESCRIPTION][DIRURL]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template2,
|
||||
\ safe_dirs, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
endfunction "}}}
|
||||
|
||||
|
||||
" use max highlighting - could be quite slow if there are too many wikifiles
|
||||
if VimwikiGet('maxhi')
|
||||
" WikiLink
|
||||
call s:add_target_syntax_OFF(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1')
|
||||
|
||||
" Subsequently, links verified on vimwiki's path are highlighted as existing
|
||||
let time01 = vimwiki#u#time(starttime) "XXX
|
||||
call s:highlight_existing_links()
|
||||
let time02 = vimwiki#u#time(starttime) "XXX
|
||||
else
|
||||
let time01 = vimwiki#u#time(starttime) "XXX
|
||||
" Wikilink
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1')
|
||||
let time02 = vimwiki#u#time(starttime) "XXX
|
||||
endif
|
||||
|
||||
" Weblink
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWeblink1, 'VimwikiWeblink1')
|
||||
|
||||
" WikiLink
|
||||
" All remaining schemes are highlighted automatically
|
||||
let rxSchemes = '\%('.
|
||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').
|
||||
\ '\):'
|
||||
|
||||
" a) match [nonwiki-scheme-URL]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template1,
|
||||
\ rxSchemes.g:vimwiki_rxWikiLink1Url, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
" b) match [DESCRIPTION][nonwiki-scheme-URL]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template2,
|
||||
\ rxSchemes.g:vimwiki_rxWikiLink1Url, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
" }}}
|
||||
|
||||
|
||||
" generic headers "{{{
|
||||
|
||||
" Header levels, 1-6
|
||||
for i in range(1,6)
|
||||
execute 'syntax match VimwikiHeader'.i.' /'.g:vimwiki_rxH{i}.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
||||
endfor
|
||||
|
||||
" }}}
|
||||
|
||||
" concealed chars " {{{
|
||||
if exists("+conceallevel")
|
||||
syntax conceal on
|
||||
endif
|
||||
|
||||
syntax spell toplevel
|
||||
|
||||
if g:vimwiki_debug > 1
|
||||
echom 'WikiLink1 Prefix: '.g:vimwiki_rxWikiLink1Prefix1
|
||||
echom 'WikiLink1 Suffix: '.g:vimwiki_rxWikiLink1Suffix1
|
||||
echom 'Weblink1 Prefix: '.g:vimwiki_rxWeblink1Prefix1
|
||||
echom 'Weblink1 Suffix: '.g:vimwiki_rxWeblink1Suffix1
|
||||
endif
|
||||
|
||||
" VimwikiWikiLink1Char is for syntax markers (and also URL when a description
|
||||
" is present) and may be concealed
|
||||
let options = ' contained transparent contains=NONE'
|
||||
" conceal wikilink1
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Prefix.'/'.options
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Suffix.'/'.options
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Prefix1.'/'.options
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Suffix1.'/'.options
|
||||
|
||||
" conceal weblink1
|
||||
execute 'syn match VimwikiWeblink1Char "'.g:vimwiki_rxWeblink1Prefix1.'"'.options
|
||||
execute 'syn match VimwikiWeblink1Char "'.g:vimwiki_rxWeblink1Suffix1.'"'.options
|
||||
|
||||
if exists("+conceallevel")
|
||||
syntax conceal off
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" non concealed chars " {{{
|
||||
" }}}
|
||||
|
||||
" main syntax groups {{{
|
||||
|
||||
" Tables
|
||||
syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
\ transparent contains=VimwikiCellSeparator,
|
||||
\ VimwikiLinkT,
|
||||
\ VimwikiWeblink1T,
|
||||
\ VimwikiWikiLink1T,
|
||||
\ VimwikiNoExistsLinkT,
|
||||
\ VimwikiEmoticons,
|
||||
\ VimwikiTodo,
|
||||
\ VimwikiBoldT,
|
||||
\ VimwikiItalicT,
|
||||
\ VimwikiBoldItalicT,
|
||||
\ VimwikiItalicBoldT,
|
||||
\ VimwikiDelTextT,
|
||||
\ VimwikiSuperScriptT,
|
||||
\ VimwikiSubScriptT,
|
||||
\ VimwikiCodeT,
|
||||
\ VimwikiEqInT,
|
||||
\ @Spell
|
||||
|
||||
" }}}
|
||||
|
||||
" header groups highlighting "{{{
|
||||
"}}}
|
||||
|
||||
|
||||
" syntax group highlighting "{{{
|
||||
hi def link VimwikiWeblink1 VimwikiLink
|
||||
hi def link VimwikiWeblink1T VimwikiLink
|
||||
|
||||
hi def link VimwikiWikiLink1 VimwikiLink
|
||||
hi def link VimwikiWikiLink1T VimwikiLink
|
||||
"}}}
|
||||
|
||||
|
||||
|
||||
" EMBEDDED syntax setup "{{{
|
||||
"}}}
|
||||
"
|
@ -4,6 +4,13 @@
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" placeholder for math environments
|
||||
let b:vimwiki_mathEnv = ""
|
||||
|
||||
" text: $ equation_inline $
|
||||
let g:vimwiki_rxEqIn = '\$[^$`]\+\$'
|
||||
let g:vimwiki_char_eqin = '\$'
|
||||
|
||||
" text: '''strong'''
|
||||
let g:vimwiki_rxBold = "'''[^']\\+'''"
|
||||
let g:vimwiki_char_bold = "'''"
|
||||
@ -34,31 +41,22 @@ let g:vimwiki_char_superscript = '^'
|
||||
let g:vimwiki_rxSubScript = ',,[^,]\+,,'
|
||||
let g:vimwiki_char_subscript = ',,'
|
||||
|
||||
" Header levels, 1-6
|
||||
let g:vimwiki_rxH1 = '^\s*=\{1}[^=]\+.*[^=]\+=\{1}\s*$'
|
||||
let g:vimwiki_rxH2 = '^\s*=\{2}[^=]\+.*[^=]\+=\{2}\s*$'
|
||||
let g:vimwiki_rxH3 = '^\s*=\{3}[^=]\+.*[^=]\+=\{3}\s*$'
|
||||
let g:vimwiki_rxH4 = '^\s*=\{4}[^=]\+.*[^=]\+=\{4}\s*$'
|
||||
let g:vimwiki_rxH5 = '^\s*=\{5}[^=]\+.*[^=]\+=\{5}\s*$'
|
||||
let g:vimwiki_rxH6 = '^\s*=\{6}[^=]\+.*[^=]\+=\{6}\s*$'
|
||||
let g:vimwiki_rxHeader = '\%('.g:vimwiki_rxH1.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH2.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH3.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH4.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH5.'\)\|'.
|
||||
\ '\%('.g:vimwiki_rxH6.'\)'
|
||||
let g:vimwiki_char_header = '\%(^\s*=\+\)\|\%(=\+\s*$\)'
|
||||
" generic headers
|
||||
let g:vimwiki_rxH = '='
|
||||
let g:vimwiki_symH = 1
|
||||
|
||||
|
||||
|
||||
" <hr>, horizontal rule
|
||||
let g:vimwiki_rxHR = '^----.*$'
|
||||
let g:vimwiki_rxHR = '^-----*$'
|
||||
|
||||
" Tables. Each line starts and ends with '||'; each cell is separated by '||'
|
||||
let g:vimwiki_rxTable = '||'
|
||||
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
||||
let g:vimwiki_rxTableSep = '|'
|
||||
|
||||
" Bulleted list items start with whitespace(s), then '*'
|
||||
" highlight only bullets and digits.
|
||||
let g:vimwiki_rxListBullet = '^\s*\*\+\([^*]*$\)\@='
|
||||
let g:vimwiki_rxListNumber = '^\s*#\+'
|
||||
let g:vimwiki_rxListBullet = '^\s*\*\+\s\%([^*]*$\)\@='
|
||||
let g:vimwiki_rxListNumber = '^\s*#\+\s'
|
||||
|
||||
let g:vimwiki_rxListDefine = '^\%(;\|:\)\s'
|
||||
|
||||
@ -66,4 +64,8 @@ let g:vimwiki_rxListDefine = '^\%(;\|:\)\s'
|
||||
let g:vimwiki_rxPreStart = '<pre>'
|
||||
let g:vimwiki_rxPreEnd = '<\/pre>'
|
||||
|
||||
" Math block
|
||||
let g:vimwiki_rxMathStart = '{{\$'
|
||||
let g:vimwiki_rxMathEnd = '}}\$'
|
||||
|
||||
let g:vimwiki_rxComment = '^\s*%%.*$'
|
||||
|
Reference in New Issue
Block a user