From a5bda652d064bfa884f0774e108ad727af5fa704 Mon Sep 17 00:00:00 2001 From: Patrik Willard Date: Tue, 9 Apr 2019 07:34:34 +0200 Subject: [PATCH 1/3] Add option to not conceal one-character markers Adds new configuration variable, "conceal_onechar_markers", defaulting to on (preserving default behaviour) Adds if-statement around relevant parts of code (as suggested in the issue), which uses the new configuration variable. Fix #315 - Don't conceal one-character markers --- autoload/vimwiki/vars.vim | 1 + doc/vimwiki.txt | 11 +++++++++++ syntax/vimwiki.vim | 38 ++++++++++++++++++++------------------ 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/autoload/vimwiki/vars.vim b/autoload/vimwiki/vars.vim index ca12974..0f83912 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_onechar_markers': {'type': type(0), 'default': 1, 'min': 0, 'max': 1}, \ '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 c471144..770d685 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -2957,6 +2957,17 @@ URLs and hides markers and URL for links that have a description. Default: 2 +------------------------------------------------------------------------------ +*g:vimwiki_conceal_onechar_markers* + +Control the concealment of one-character markers. + +Setting 'conceal_onechar_markers' to 0 will show the markers, overriding +whatever value is set in |g:vimwiki_conceallevel| + +Default: 1 + + ------------------------------------------------------------------------------ *g:vimwiki_conceal_pre* diff --git a/syntax/vimwiki.vim b/syntax/vimwiki.vim index 94cf1c5..8eae213 100644 --- a/syntax/vimwiki.vim +++ b/syntax/vimwiki.vim @@ -155,24 +155,26 @@ endfor " possibly concealed chars let s:conceal = exists("+conceallevel") ? ' conceal' : '' -execute 'syn match VimwikiEqInChar contained /'. - \ vimwiki#vars#get_syntaxlocal('char_eqin').'/'.s:conceal -execute 'syn match VimwikiBoldChar contained /'. - \ vimwiki#vars#get_syntaxlocal('char_bold').'/'.s:conceal -execute 'syn match VimwikiItalicChar contained /'. - \ vimwiki#vars#get_syntaxlocal('char_italic').'/'.s:conceal -execute 'syn match VimwikiBoldItalicChar contained /'. - \ vimwiki#vars#get_syntaxlocal('char_bolditalic').'/'.s:conceal -execute 'syn match VimwikiItalicBoldChar contained /'. - \ vimwiki#vars#get_syntaxlocal('char_italicbold').'/'.s:conceal -execute 'syn match VimwikiCodeChar contained /'. - \ vimwiki#vars#get_syntaxlocal('char_code').'/'.s:conceal -execute 'syn match VimwikiDelTextChar contained /'. - \ vimwiki#vars#get_syntaxlocal('char_deltext').'/'.s:conceal -execute 'syn match VimwikiSuperScript contained /'. - \ vimwiki#vars#get_syntaxlocal('char_superscript').'/'.s:conceal -execute 'syn match VimwikiSubScript contained /'. - \ vimwiki#vars#get_syntaxlocal('char_subscript').'/'.s:conceal +if vimwiki#vars#get_global('conceal_onechar_markers') == 1 + execute 'syn match VimwikiEqInChar contained /'. + \ vimwiki#vars#get_syntaxlocal('char_eqin').'/'.s:conceal + execute 'syn match VimwikiBoldChar contained /'. + \ vimwiki#vars#get_syntaxlocal('char_bold').'/'.s:conceal + execute 'syn match VimwikiItalicChar contained /'. + \ vimwiki#vars#get_syntaxlocal('char_italic').'/'.s:conceal + execute 'syn match VimwikiBoldItalicChar contained /'. + \ vimwiki#vars#get_syntaxlocal('char_bolditalic').'/'.s:conceal + execute 'syn match VimwikiItalicBoldChar contained /'. + \ vimwiki#vars#get_syntaxlocal('char_italicbold').'/'.s:conceal + execute 'syn match VimwikiCodeChar contained /'. + \ vimwiki#vars#get_syntaxlocal('char_code').'/'.s:conceal + execute 'syn match VimwikiDelTextChar contained /'. + \ vimwiki#vars#get_syntaxlocal('char_deltext').'/'.s:conceal + execute 'syn match VimwikiSuperScript contained /'. + \ vimwiki#vars#get_syntaxlocal('char_superscript').'/'.s:conceal + execute 'syn match VimwikiSubScript contained /'. + \ vimwiki#vars#get_syntaxlocal('char_subscript').'/'.s:conceal +endif let s:options = ' contained transparent contains=NONE' From 8fbe51d61491e2486f893bf2a2c0890d84c8b097 Mon Sep 17 00:00:00 2001 From: Patrik Willard Date: Tue, 9 Apr 2019 22:31:41 +0200 Subject: [PATCH 2/3] Update with review comments --- doc/vimwiki.txt | 1 + syntax/vimwiki.vim | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 770d685..75588a2 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -3240,6 +3240,7 @@ Contributors and their Github usernames in roughly chronological order: - Nick Borden (@hcwndbyw) - Steven Stallion (@sstallion) - Rane Brown (@ranebrown) + - Patrik Willard (@padowi) ============================================================================== diff --git a/syntax/vimwiki.vim b/syntax/vimwiki.vim index 8eae213..c41a4a4 100644 --- a/syntax/vimwiki.vim +++ b/syntax/vimwiki.vim @@ -155,7 +155,7 @@ endfor " possibly concealed chars let s:conceal = exists("+conceallevel") ? ' conceal' : '' -if vimwiki#vars#get_global('conceal_onechar_markers') == 1 +if vimwiki#vars#get_global('conceal_onechar_markers') execute 'syn match VimwikiEqInChar contained /'. \ vimwiki#vars#get_syntaxlocal('char_eqin').'/'.s:conceal execute 'syn match VimwikiBoldChar contained /'. From b172db23d307896f35f9b7a8f3ff2bf02aaf8099 Mon Sep 17 00:00:00 2001 From: Patrik Willard Date: Wed, 10 Apr 2019 16:00:50 +0200 Subject: [PATCH 3/3] Add changelog entry --- doc/vimwiki.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 75588a2..687c8f5 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -3256,6 +3256,8 @@ https://github.com/vimwiki-backup/vimwiki/issues. 2.5 (in progress)~ New:~ + * PR #663: New option |g:vimwiki_conceal_onechar_markers| to control + whether to show or hide single-character format markers. * PR #636: Wiki local option |vimwiki-option-exclude_files| which is a list of patterns to exclude when checking or generating links. * PR #644: Key mapping gnt to jump to the next open task.