From e56c26c7ba892fc6ee073df0f2457d899d24d433 Mon Sep 17 00:00:00 2001 From: Greg Anders Date: Thu, 28 Mar 2019 14:49:42 -0700 Subject: [PATCH 1/3] Add an option to conceal preformatted text blocks This merges PR #641. --- autoload/vimwiki/base.vim | 3 ++- autoload/vimwiki/vars.vim | 1 + doc/vimwiki.txt | 20 ++++++++++++++++++++ syntax/vimwiki.vim | 6 ++++-- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index a76962a..cf12dc4 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -1022,10 +1022,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. diff --git a/autoload/vimwiki/vars.vim b/autoload/vimwiki/vars.vim index 02c09c9..250bfc1 100644 --- 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': \ { diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index e02d4a7..da6e700 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -2887,6 +2887,26 @@ URLs and hides markers and URL for links that have a description. 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* diff --git a/syntax/vimwiki.vim b/syntax/vimwiki.vim index fb311b4..30b0e5b 100644 --- a/syntax/vimwiki.vim +++ b/syntax/vimwiki.vim @@ -318,8 +318,9 @@ execute 'syntax match VimwikiCodeT /'.vimwiki#vars#get_syntaxlocal('rxCode'). "
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 From b849a411e3ba355c2dfb2b7faecfa6f30bcc145f Mon Sep 17 00:00:00 2001 From: Michal Cizmazia Date: Fri, 29 Mar 2019 21:25:27 +0100 Subject: [PATCH 2/3] Add toc_link_format option Add an option for setting the format of the links in the Table of Contents: - Extended (the current and default) - Brief (new format for the Vimwiki markup) --- autoload/vimwiki/base.vim | 16 ++++++++++------ autoload/vimwiki/vars.vim | 1 + doc/vimwiki.txt | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index cf12dc4..c131bfb 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -1893,11 +1893,13 @@ 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 + 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] if numbering > 0 && numbering <= h_level @@ -1916,8 +1918,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 index 250bfc1..b95a3dc 100644 --- a/autoload/vimwiki/vars.vim +++ b/autoload/vimwiki/vars.vim @@ -181,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 index da6e700..5ebb612 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -2992,6 +2992,21 @@ are from 1 to 6. 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* From d089a2c65a9f5f35d64fe93c1d21e867585bba06 Mon Sep 17 00:00:00 2001 From: W Date: Sat, 30 Mar 2019 20:22:12 +0000 Subject: [PATCH 3/3] Add info about bold&italic text to the doc --- doc/vimwiki.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 5ebb612..5a7bbe3 100644 --- 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^