Foldmethod=indent 变得混乱

发布于 2024-09-04 23:12:29 字数 305 浏览 9 评论 0原文

通常来说,这对人类来说是一大福音,但有时 vim 基于缩进的折叠会变得混乱,需要通过 :set Foldmethod=indent 进行重置。症状包括窗口中出现连续的折叠线。

有没有办法避免这种情况发生?只有我吗?

更新

虽然我现在很确定我已经发现了一个错误,但尝试我的错误重现脚本(链接到我的答案)的人的答案将真正回答我的第二个问题。如果有人可以告诉我有关修复这种粗略行为的神秘设置,他们将获得 25 分(假设所述建议以答案的形式表述)。事实上,我想我会等一两天,以确保我不会用非错误报告来困扰 vim 的优秀人员。

Normally a great boon to humanity, on occasion vim's indent-based folding will get confused and need a reset via :set foldmethod=indent. Symptoms include the appearance of consecutive folded lines in the window.

Is there a way to avoid having this happen? Is it just me?

update

Although I'm pretty sure at this point that I've ID'd a bug, answers from people who try my bug reproduction script (linked to in my answer) will serve to actually answer my second question. And if somebody can tell me about the arcane setting that fixes this sketchy behaviour, they get 25 points (assuming that said advice is phrased in the form of an Answer). Actually I think I'll wait a day or two just to make sure I don't pester the good people of vim with a non-bug report.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

内心旳酸楚 2024-09-11 23:12:29

我已经成功地重现了这个错误。

http://gist.github.com/ 提供了一个 vim 脚本,它可以为您的调试乐趣进行有趣的历史重演。 427303。如果某些流氓决定用巴尔扎克引文修改要点,我将链接到当前修订 也是如此。

在这一点上,这似乎很明显是一个错误,所以我将继续报告它。我将在错误报告中引用这篇文章,因此此处报告的任何进一步信息应该对调试器有用。

我正在运行 vim-gnome 软件包,版本为“2:7.2.330-1ubuntu3”。如果我的 vim 安装出现问题,这里是我的脚本创建的“分析”窗口的输出:

  change: Initial setup
  line [foldlevel: contents]:
    0: '  first section'
    1: '    first subsection'
    2: ''
    0: 'second section'
    0: '  second subsection'

  change: Indent the empty-line-delimited last section
  line [foldlevel: contents]:
    0: '  first section'
    1: '    first subsection'
    2: ''
    0: '  second section'
    1: '    second subsection'

  change: Delete the empty line
  line [foldlevel: contents]:
    0: '  first section'
    1: '    first subsection'
    2: '  second section'
    1: '    second subsection'

  change: Fold things in a way that demonstrates the bug
  line [foldlevel: contents]:
    0: '  first section'
    1: '    first subsection'
    2: '  second section'
    1: '    second subsection'

编辑

这是一个 已知问题

I've managed to reproduce this bug.

A vimscript which will conduct an entertaining historical reenactment for your debugging pleasure is available at http://gist.github.com/427303. In case some hooligan decides to revise the gist with Balzac quotations, I'll link to the current revision as well.

At this point it seems to be pretty clearly a bug, so I'll go ahead and report it. I'll reference this post in the bug report, so any further information reported here should be useful to the debuggers.

I'm running the vim-gnome package, version '2:7.2.330-1ubuntu3'. In case something is totally screwy with my vim install, here's the output from the 'analysis' window that my script creates:

  change: Initial setup
  line [foldlevel: contents]:
    0: '  first section'
    1: '    first subsection'
    2: ''
    0: 'second section'
    0: '  second subsection'

  change: Indent the empty-line-delimited last section
  line [foldlevel: contents]:
    0: '  first section'
    1: '    first subsection'
    2: ''
    0: '  second section'
    1: '    second subsection'

  change: Delete the empty line
  line [foldlevel: contents]:
    0: '  first section'
    1: '    first subsection'
    2: '  second section'
    1: '    second subsection'

  change: Fold things in a way that demonstrates the bug
  line [foldlevel: contents]:
    0: '  first section'
    1: '    first subsection'
    2: '  second section'
    1: '    second subsection'

edit

This is a known issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文