是否存在与emacs的x符号相当的vim?

时间:2011-11-24 01:37:25

标签: vim plugins syntax formatting

我正在编写一个vim插件,我想有一些方法在缓冲区中使用替代字形显示一些令牌以提高可读性。是否存在解决此问题的方法?它甚至可能在vim内吗?

我想到的是像emacs包x-symbol - http://x-symbol.sourceforge.net/

1 个答案:

答案 0 :(得分:3)

你会得到

的基础知识
:se list

listchars选项。

但这并不是非常可扩展的。对于更多涉及的工作,您可以创建隐藏语法规则:

隐蔽

:he syn-conceal
:he 'cole'
:he hl-Conceal

摘录:

语法规则

 conceal                      *conceal* *:syn-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.

concealends                       *:syn-concealends*
When the "concealends" argument is given, the start and end matches of
the region, but not the contents of the region, are marked as concealable.
Whether or not they are actually concealed depends on the setting on the
'conceallevel' option. The ends of a region can only be concealed separately
in this way when they have their own highlighting via "matchgroup"
cchar                         *:syn-cchar*
The "cchar" argument defines the character shown in place of the item
when it is concealed (setting "cchar" only makes sense when the conceal
argument is given.) If "cchar" is not set then the default conceal
character defined in the 'listchars' option is used. Example: >
   :syntax match Entity "&" conceal cchar=&

See |hl-Conceal| for highlighting.

隐瞒等级

 'conceallevel' 'cole'        *'conceallevel'* *'cole'*

        number (default 0)
        local to window
        {not in Vi}
        {not available when compiled without the |+conceal|
        feature}
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.

Note: in the cursor line concealed text is not hidden, so that you can
edit and copy the text.  This can be changed with the 'concealcursor'
option.