vimwiki

Personal wiki for vim
git clone https://github.com/vimwiki/vimwiki.git
Log | Files | Refs | README | LICENSE

commit 0e664a62309e55cbe25b846ba0001efde6f3cca6
parent fc158ba744a7a9657d91631efb6591c4f3c08807
Author: Steven Stallion <sstallion@gmail.com>
Date:   Sat, 30 Mar 2019 20:34:57 -0500

Merge branch 'dev' of git://github.com/vimwiki/vimwiki into sstallion/autogenerate-tags

Diffstat:
Mautoload/vimwiki/base.vim | 25++++++++++++-------------
Mautoload/vimwiki/vars.vim | 2++
Mdoc/vimwiki.txt | 37+++++++++++++++++++++++++++++++++++++
Msyntax/vimwiki.vim | 6++++--
4 files changed, 55 insertions(+), 15 deletions(-)

diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim @@ -1027,10 +1027,11 @@ function! vimwiki#base#nested_syntax(filetype, start, end, textSnipHl) abort let group='texMathZoneGroup' endif + let concealpre = vimwiki#vars#get_global('conceal_pre') ? ' concealends' : '' execute 'syntax region textSnip'.ft. \ ' matchgroup='.a:textSnipHl. \ ' start="'.a:start.'" end="'.a:end.'"'. - \ ' contains=@'.group.' keepend' + \ ' contains=@'.group.' keepend'.concealpre " A workaround to Issue 115: Nested Perl syntax highlighting differs from " regular one. @@ -1904,18 +1905,14 @@ function! vimwiki#base#table_of_contents(create) for idx in range(h_level, 5) | let headers_levels[idx] = ['', 0] | endfor let h_complete_id = '' - for l in range(h_level-1) - if headers_levels[l][0] != '' - let h_complete_id .= headers_levels[l][0].'#' - endif - endfor - let h_complete_id .= headers_levels[h_level-1][0] - - if numbering > 0 && numbering <= h_level - let h_number = join(map(copy(headers_levels[numbering-1 : h_level-1]), 'v:val[1]'), '.') - let h_number .= vimwiki#vars#get_global('html_header_numbering_sym') - let h_text = h_number.' '.h_text + if vimwiki#vars#get_global('toc_link_format') == 0 + for l in range(h_level-1) + if headers_levels[l][0] != '' + let h_complete_id .= headers_levels[l][0].'#' + endif + endfor endif + let h_complete_id .= headers_levels[h_level-1][0] call add(complete_header_infos, [h_level, h_complete_id, h_text]) endfor @@ -1927,8 +1924,10 @@ function! vimwiki#base#table_of_contents(create) for [lvl, link, desc] in complete_header_infos if vimwiki#vars#get_wikilocal('syntax') == 'markdown' let link_tpl = vimwiki#vars#get_syntaxlocal('Weblink2Template') - else + elseif vimwiki#vars#get_global('toc_link_format') == 0 let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate2') + else + let link_tpl = vimwiki#vars#get_global('WikiLinkTemplate1') endif let link = s:safesubstitute(link_tpl, '__LinkUrl__', \ '#'.link, '') diff --git a/autoload/vimwiki/vars.vim b/autoload/vimwiki/vars.vim @@ -145,6 +145,7 @@ function! s:read_global_settings_from_user() \ 'auto_chdir': {'type': type(0), 'default': 0, 'min': 0, 'max': 1}, \ 'autowriteall': {'type': type(0), 'default': 1, 'min': 0, 'max': 1}, \ 'conceallevel': {'type': type(0), 'default': 2, 'min': 0, 'max': 3}, + \ 'conceal_pre': {'type': type(0), 'default': 0, 'min': 0, 'max': 1}, \ 'create_link': {'type': type(0), 'default': 1, 'min':0, 'max': 1}, \ 'diary_months': {'type': type({}), 'default': \ { @@ -180,6 +181,7 @@ function! s:read_global_settings_from_user() \ 'tags_header_level': {'type': type(0), 'default': 1, 'min': 1, 'max': 5}, \ 'toc_header': {'type': type(''), 'default': 'Contents', 'min_length': 1}, \ 'toc_header_level': {'type': type(0), 'default': 1, 'min': 1, 'max': 6}, + \ 'toc_link_format': {'type': type(0), 'default': 0, 'min': 0, 'max': 1}, \ 'url_maxsave': {'type': type(0), 'default': 15, 'min': 0}, \ 'use_calendar': {'type': type(0), 'default': 1, 'min': 0, 'max': 1}, \ 'use_mouse': {'type': type(0), 'default': 0, 'min': 0, 'max': 1}, diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt @@ -878,6 +878,8 @@ is decorated: > *bold text* _italic text_ + _*bold italic text*_ + *_bold italic text _* ~~strikeout text~~ `code (no syntax) text` super^script^ @@ -2910,6 +2912,26 @@ Default: 2 ------------------------------------------------------------------------------ +*g:vimwiki_conceal_pre* + +Conceal preformatted text markers. For example, +> + {{{python + def say_hello(): + print("Hello, world!") + }}} +> +would appear as simply +> + def say_hello(): + print("Hello, world!") +> +in your wiki file. + +Default: 0 + + +------------------------------------------------------------------------------ *g:vimwiki_autowriteall* Automatically save a modified wiki buffer when switching wiki pages. Has the @@ -2995,6 +3017,21 @@ The default is 1. ------------------------------------------------------------------------------ +*g:vimwiki_toc_link_format* + +The format of the links in the Table of Contents (see |vimwiki-toc|). + + +Value Description~ +0 Extended: The link contains the description and URL. URL + references all levels. +1 Brief: The link contains only the URL. URL references only + the immediate level. + +Default: 0 + + +------------------------------------------------------------------------------ *g:vimwiki_map_prefix* A string which specifies the prefix for all global mappings (and some local diff --git a/syntax/vimwiki.vim b/syntax/vimwiki.vim @@ -318,8 +318,9 @@ execute 'syntax match VimwikiCodeT /'.vimwiki#vars#get_syntaxlocal('rxCode'). " <hr> horizontal rule execute 'syntax match VimwikiHR /'.vimwiki#vars#get_syntaxlocal('rxHR').'/' -execute 'syntax region VimwikiPre start=/'.vimwiki#vars#get_syntaxlocal('rxPreStart'). - \ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxPreEnd').'/ contains=@Spell' +let concealpre = vimwiki#vars#get_global('conceal_pre') ? ' concealends' : '' +execute 'syntax region VimwikiPre matchgroup=VimwikiPreDelim start=/'.vimwiki#vars#get_syntaxlocal('rxPreStart'). + \ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxPreEnd').'/ contains=@Spell'.concealpre execute 'syntax region VimwikiMath start=/'.vimwiki#vars#get_syntaxlocal('rxMathStart'). \ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxMathEnd').'/ contains=@Spell' @@ -395,6 +396,7 @@ hi def link VimwikiCodeT VimwikiCode hi def link VimwikiPre PreProc hi def link VimwikiPreT VimwikiPre +hi def link VimwikiPreDelim VimwikiPre hi def link VimwikiMath Number hi def link VimwikiMathT VimwikiMath