是否可以在 Vim 中显示缩进指南? [英] Is it possible to display indentation guides in Vim?

查看:13
本文介绍了是否可以在 Vim 中显示缩进指南?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Vim 的长期用户(3 或 4 年),最近开始处理一些深度嵌套的代码.这段代码用空格缩进,而不是制表符.我想要一些干净且不分散注意力的缩进指示,以帮助跟踪我在查看多个级别深度的内容时所在的代码块.

I'm a longtime Vim user (3 or 4 years) who has recently started dealing with some deeply nested code. This code is indented with spaces, not tabs. I would like some clean and non-distracting indication of indentation to help with keeping track of which block of code I'm in when I'm looking at something many levels deep.

:set list 

只显示制表符和结束符.我找到了一个插件(目前似乎无法挖掘它),它将以逐渐变暗的颜色突出显示每个缩进级别,但这在视觉上没有吸引力.理想情况下,我希望在每个缩进级别看到细垂直线.许多新奇的编辑器都有这个功能,但我还不愿意放弃 Vim.

only displays tab and endline characters. I have found one plugin (can't seem to dig it up at the moment) that will highlight each indentation level in progressively darker colors but this is visually unappealing. Ideally I would like to see thin vertical lines at each indentation level. Many new-fangled editors have this functionality but I'm not willing to give up on Vim just yet.

有谁知道这是如何实现的?

Does anyone know how this can be achieved?

推荐答案

这个回答来晚了,也是无耻的插件.:)

无论如何,试试我的 Indent-Guides.vim 插件.它的创建是为了解决我自己对 vim 中缺少缩进指南的问题.我厌倦了等待别人来建造它,所以我自己做了.

Regardless, try my Indent-Guides.vim plugin. It was created to scratch my own itch regarding the lack of indent guides in vim. I got fed-up waiting for someone else to come along and build it, so I just did it myself.

特点:

  • 可以检测制表符和空格缩进样式.
  • 自动检查您的配色方案并选择合适的颜色(仅限 gVim).
  • 将使用交替颜色突出显示缩进级别.
  • 对 gVim 的完全支持和对终端 Vim 的基本支持.
  • 似乎可以在 Windows gVim 7.3 上运行(不过还没有进行任何广泛的测试).
  • 缩进指南的可自定义大小,例如.瘦指南(仅限软标签).
  • 可自定义的起始缩进级别.

以下是该插件的一些截图:将鼠标放在此处并点击.

Here’s a few screenshots of the plugin in action: put your mouse here and click.

这篇关于是否可以在 Vim 中显示缩进指南?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆