3

Is there a way, built-in or with a plugin, to get an outline of my code in Vim?

In Eclipse, there is a panel that shows an outline of the code in the file, showing a breakdown of the classes and methods:

MyClass
  MyClass()
  myMethod(int, String)
AnotherClass
  someMoreMethod()

Anything is possible in Vim, but is there currently a way to do this, either built-in or by installing a plugin?

Support for jumping to the different methods would be nice, but all I need is something to show the structure of the code. I would prefer a solution that worked for most of the top languages, but I really need Perl support (and yes, I know my sample code is Java).

5

This is possible with Tagbar plugin, which use ctags to generate the tags. Used in collaboration with Universal Ctags, it supports various langages.

0

In the interests of completeness, this can also be done with the Taglist plugin. Most of the advice you will find on the internet recommends the newer Tagbar over Taglist, but reports of the latter's demise seem to have been exaggerated — it was updated as recently as 2013 — and it remains the top-rated and most downloaded plugin on the official Vim site's script pages.

One possible advantage is that Taglist allows the display of tags from multiple files, whereas Tagbar always displays the tags from the current file. I switched to Tagbar several years ago, though, so I'm afraid I can't give a detailed rundown of the differences.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.