Syntax: Emoji faster conceal with keyword

This commit is contained in:
Tinmarino 2020-08-09 21:22:04 -04:00
parent a1f1b9c290
commit a241d458ab
3 changed files with 11 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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