From a241d458ab6155a7278d60f0b543949dad18ad1f Mon Sep 17 00:00:00 2001 From: Tinmarino Date: Sun, 9 Aug 2020 21:22:04 -0400 Subject: [PATCH] Syntax: Emoji faster conceal with keyword --- autoload/vimwiki/emoji.vim | 3 ++- doc/vimwiki.txt | 4 ++-- syntax/vimwiki.vim | 13 +++++++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/autoload/vimwiki/emoji.vim b/autoload/vimwiki/emoji.vim index 2ad0182..32b1fd5 100644 --- a/autoload/vimwiki/emoji.vim +++ b/autoload/vimwiki/emoji.vim @@ -1768,8 +1768,9 @@ endfunction " Conceal function! vimwiki#emoji#apply_conceal() abort + syn iskeyword 0-9,a-z,A-Z,:-: for [name, emoji] in items(s:emoji_single) - exe 'syn match VimwikiEmoji ":' . name . ':" conceal cchar=' . emoji + exe 'syn keyword VimwikiEmoji :' . name . ': conceal cchar=' . emoji endfor endfunction diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 3f1f404..eda6482 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -3579,7 +3579,7 @@ The default is %%%s. ------------------------------------------------------------------------------ *g:vimwiki_emoji_enable* -Bitfield: Enable/disable emoji conceal and complete (with |i_CTRL-X_CTRL-U|). +Bitfield: Enable/disable emoji conceal and complete Note that the |completefunc| is only set if it does not exists already to keep other plugin works by default. It can be set it manualy with: > set completefunc=vimwiki#emoji#complete @@ -3592,7 +3592,7 @@ Emoji features hard copied from https://github.com/junegunn/vim-emoji Value Description~ 0 Disable emoji support 1 Enable emoji conceal -2 Enable emoji complete +2 Enable emoji complete (with |i_CTRL-X_CTRL-U|) 3 Enable both Default: 3 diff --git a/syntax/vimwiki.vim b/syntax/vimwiki.vim index 4282fd8..e9d954d 100644 --- a/syntax/vimwiki.vim +++ b/syntax/vimwiki.vim @@ -347,12 +347,6 @@ let s:typeface_dic = vimwiki#vars#get_syntaxlocal('dTypeface') call vimwiki#u#hi_typeface(s:typeface_dic) -" Emoji: :dog: (after tags to take precedence) -if and(vimwiki#vars#get_global('emoji_enable'), 1) != 0 && has('conceal') - call vimwiki#emoji#apply_conceal() -endif - - " Link highlighting groups """""""""""""""""""""""""" @@ -513,4 +507,11 @@ for u in syntax_dic.dTypeface.eq \ . ' keepend oneline '. b:vimwiki_syntax_concealends endfor +" Emoji: :dog: (after tags to take precedence, after nested to not be reset) +if and(vimwiki#vars#get_global('emoji_enable'), 1) != 0 && has('conceal') + call vimwiki#emoji#apply_conceal() + exe 'syn iskeyword '.&iskeyword.',-,:' +endif + + syntax spell toplevel