In Vim, how to keep characters concealed even when cursor enters that line
Only one command is needed: set concealcursor=n
:help conceal
When the "conceal" argument is given, the item is marked as concealable. Whether or not it is actually concealed depends on the value of the 'conceallevel' option. The 'concealcursor' option is used to decide whether concealable items in the current line are displayed unconcealed to be able to edit the line.
:help concealcursor
Sets the modes in which text in the cursor line can also be concealed. When the current mode is listed then concealing happens just like in other lines.
- n Normal mode
- v Visual mode
- i Insert mode
- c Command line editing, for 'incsearch'
'v' applies to all lines in the Visual area, not only the cursor. A useful value is "nc". This is used in help files. So long as you are moving around text is concealed, but when starting to insert text or selecting a Visual area the concealed text is displayed, so that you can see what you are doing. Keep in mind that the cursor position is not always where it's displayed. E.g., when moving vertically it may change column.
Also, :help conceallevel
Determine how text with the "conceal" syntax attribute |:syn-conceal| is shown:
Value Effect ~
- 0 Text is shown normally
- 1 Each block of concealed text is replaced with one character. If the syntax item does not have a custom replacement character defined (see |:syn-cchar|) the character defined in 'listchars' is used (default is a space). It is highlighted with the "Conceal" highlight group.
- 2 Concealed text is completely hidden unless it has a custom replacement character defined (see |:syn-cchar|).
- 3 Concealed text is completely hidden.