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

查看:99
本文介绍了是否可以在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.

有人知道如何实现吗?

推荐答案

注意:这个答案对聚会来说有点迟了,而且是一个无耻的插件:)

NOTE: This answer is a bit late to the party and also a shameless plug :)

无论如何,请尝试使用我的 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的完全支持和对Terminal 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天全站免登陆