# change how a character is displayed

Is it possible to change how a character is displayed?

I explain better, I want to replace the character '*' with math unicode '∗' [U+2217]. This should affect only the way the character is displayed not the file content.

Note: I have already tried to use the conceal feature, however I am not really satisfied by the result.

I would like to have a behaviour similar to listchars and list for example listchars=space:.

• what did you try? – Christian Brabandt Nov 20 '17 at 13:13
• ops I didn't check the 'concealcursor' option! I solved and got exactly the behaviour. Solution syntax match Normal /\*/ conceal cchar=∗ and set conceallevel=1 and set concealcursor=ni – nicmus Nov 20 '17 at 13:23
• @nicmus You should post that as an answer if it solves the issue for you. Answering your own question is allowed! – Rich Nov 20 '17 at 13:50

So as suggested I will give the solution I found.

After having

set conceallevel=1
set concealcursor=ni


there are two ways to achieve the result:

1) using :syntax match

:syntax match Conceal /\*/ conceal cchar=∗


2) using matchadd

:call matchadd('Conceal','\*',10,-1,{'conceal': '∗'})


Note

• 10 is the priority (default is 10)
• -1 is the match ID (see help matchadd)

You might also consider

:hi! link Conceal Normal


to link the syntax highlighting of Conceal group to Normal group.