为什么第一个散列标记会在 vim 折叠中消失?
Why does the first hash mark disappear in a vim fold?
我正在使用手动折叠来编写 perl 程序。这是一个典型的折叠:
sub do_something # does something --{{{
{
# perl code here
} # --}}}
折叠时,这四行是这样显示的:
+-- 4 lines: sub do_something does something ----------------------------
在折叠版本中,"does" 一词之前的井号已经消失。为什么?如果这是一项功能,我该如何禁用它?作为一种解决方法,我正在编写 'sub do_something ## does something --{{{',但是是否有一种干净的方法可以让 vim 只显示我输入的内容? (也许这与perl.vim有关?)
显示的内容而不是折叠线由 'foldtext'
选项控制。默认情况下,使用内部 foldtext()
函数。 :help foldtext()
说明:
The returned string looks like this:
+-- 45 lines: abcdef
The number of dashes depends on the foldlevel. The "45" is
the number of lines in the fold. "abcdef" is the text in the
first non-blank line of the fold. Leading white space, "//"
or "/*" and the text from the 'foldmarker' and 'commentstring'
options is removed.
如您所见,这是 Vim 的启发式方法,旨在减少混乱。要关闭它:
- 可以清除
'commentstring'
;它仅用于通过将 :setlocal commentstring=
放入 ~/.vim/after/ftplugin/perl.vim
. 来添加手动折叠标记(一些评论插件可能依赖它作为后备)
- 您可以编写自己的折叠函数(
:help fold-foldtext
中的示例和说明),然后全局安装或(如上面的替代方案)仅针对 Perl 文件类型安装它。
我正在使用手动折叠来编写 perl 程序。这是一个典型的折叠:
sub do_something # does something --{{{
{
# perl code here
} # --}}}
折叠时,这四行是这样显示的:
+-- 4 lines: sub do_something does something ----------------------------
在折叠版本中,"does" 一词之前的井号已经消失。为什么?如果这是一项功能,我该如何禁用它?作为一种解决方法,我正在编写 'sub do_something ## does something --{{{',但是是否有一种干净的方法可以让 vim 只显示我输入的内容? (也许这与perl.vim有关?)
显示的内容而不是折叠线由 'foldtext'
选项控制。默认情况下,使用内部 foldtext()
函数。 :help foldtext()
说明:
The returned string looks like this: +-- 45 lines: abcdef The number of dashes depends on the foldlevel. The "45" is the number of lines in the fold. "abcdef" is the text in the first non-blank line of the fold. Leading white space, "//" or "/*" and the text from the 'foldmarker' and 'commentstring' options is removed.
如您所见,这是 Vim 的启发式方法,旨在减少混乱。要关闭它:
- 可以清除
'commentstring'
;它仅用于通过将:setlocal commentstring=
放入~/.vim/after/ftplugin/perl.vim
. 来添加手动折叠标记(一些评论插件可能依赖它作为后备)
- 您可以编写自己的折叠函数(
:help fold-foldtext
中的示例和说明),然后全局安装或(如上面的替代方案)仅针对 Perl 文件类型安装它。