Reputation: 161914
In vimwiki
, I can input a link like this:
[[link]]
When I put cursor on the line, [[]]
is visible:
>[[http://www.google.com/]]<
When the cursor is moved away, [[]]
is invisible:
>http://www.google.com/<
I notice this behavior in vim's help manual(:help vim
): *vim:*
(*
s are invisible until I type V).
I cannot figure out how it works. Thanks for your help.
Upvotes: 5
Views: 4185
Reputation: 40947
This is a feature called "conceal" that was added in vim 7.3 (if I recall correctly). For a simple example, try this.
Open a buffer and type three lines, the middle one being "foobarbaz". Then enter the following ex commands:
set conceallevel=2
syntax match Todo /bar/ conceal
When your cursor is on the "foobarbaz" line, "bar" will be visible (and highlighted with the Todo highlight group if you have syntax highlighting on). Once you move off the line, "bar" will disappear.
For more information see :help conceal
and :help conceallevel
.
Upvotes: 10
Reputation: 3300
I think that hiding text can be a very helpful feature. Think about text folding or readability of links.
To hide text Vim 7.3 has introduced the "conceal" argument. Hiding text is a well defined Vim feature. It is not a dirty trick. See
:help :syn-conceal
:help 'conceallevel'
:help 'concealcursor'
Please note that conceal works only for syntax regions, not for matches.
I have no experience with conceal, so I can't provide an example out of the box.
Habi
Upvotes: 5