gpt4 book ai didi

vim - 是否有相当于 emacs 的 x 符号的 vim?

转载 作者:行者123 更新时间:2023-12-04 06:06:55 24 4
gpt4 key购买 nike

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

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

最佳答案

你会得到非常基础的

: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.

关于vim - 是否有相当于 emacs 的 x 符号的 vim?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8251301/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com