简体   繁体   English

如何让VIM始终显示当前块层次结构?

[英]How can I have VIM always display the current block hierarchy?

class Foo
  class Bar
    # many lines
    # many lines
    # many lines
    # many lines
    CURSOR
    # many lines
    # many lines
  end
end

If the line "class Bar" is currently outside of the screen, I'd like to have the current blocks' head still visible. 如果“class Bar”行当前在屏幕之外,我希望当前块的头部仍然可见。 Or, better yet, a hierarchical form like so: 或者,更好的是,这样的层次结构形式:

class Foo > class Bar > current method/function

How can I achieve that in VIM? 我怎样才能在VIM中实现这一目标?

You can achieve that through plugins, of which I suggest two: 你可以通过插件实现这一点,我建议两个:

  1. tagbar plugin, as already suggested by @Kent. tagbar插件,正如@Kent所建议的那样。
  2. vim-airline plugin with tagbar extension enabled. 启用了标记栏扩展名的vim-airline插件。

This, together with ctags, Vim will always show your current context in the right side of your status line. 这与ctags一起,Vim将始终在状态行的右侧显示您当前的上下文。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM