sponsor Vim development Vim logo Vim Book Ad

Tagbar : Display tags of the current file ordered by scope

 script karma  Rating 871/262, Downloaded by 11439    Comments, bugs, improvements  Vim wiki

created by
Jan Larres
 
script type
utility
 
description
Tagbar displays the tags of the current file in a sidebar, similar to vimscript #273. But it has the advantage that it will display them ordered by their scope -- for example, methods and members in languages like C++, Python or Java will be listed under their correct class instead of just under the general categories 'functions' or 'variables'. This gives a more helpful overview of the file.

Additionally the Tagbar window can be used to quickly jump to tags.

Tagbar requires Exuberant ctags (http://ctags.sourceforge.net/) in at least version 5.5 to work.

Plugin homepage with screenshots:
http://majutsushi.github.com/tagbar/

Code repository:
https://github.com/majutsushi/tagbar
 
install details
Use the normal Vimball installation method to install Tagbar:

    vim tagbar.vba
    :so %
    :q

If ctags is not installed in one of the directories in your $PATH environment variable you have to set the option g:tagbar_ctags_bin, see the documentation for exact instructions.

Note: Vim versions < 7.0.167 have a bug that prevents Tagbar from working. If you are affected by this use this alternate Tagbar download instead:
https://github.com/majutsushi/tagbar/zipball/70fix
It is on par with version 2.2 but probably won't be updated after that.

Quickstart:

Put something like the following into your ~/.vimrc:

nmap <F8> :TagbarToggle<CR>

Then the F8 key will toggle the Tagbar window. You can of course use any shortcut you want. For more flexible ways to open and close the window (and the rest of the functionality) see the documentation.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
tagbar.vmb 2.6.1 2014-01-23 7.0 Jan Larres - Automatically close the preview window when jumping to a tag
- Don't forget the previous window in certain situations, which was causing
  problems with for example fugitive
- Fixed toggling kind-specific folds
- Fixed ctags error that can happen with Cygwin
tagbar.vmb 2.6 2013-12-05 7.0 Jan Larres - Added possibility to show tags in the preview window, either manually or
  automatically.
- Allow customizing the statusline, see :help g:tagbar_status_func.
- Type configuration can now be project-specific.
- The keybindings in the Tagbar window are now configurable.
- Improvements to Ctags execution on Windows, thanks to Darcy Parker.
- Added function tagbar#currentfile() that returns the path to the file
  currently being displayed in Tagbar, thanks to Zhao Cai.
- Added a :Tagbar command as an alias for :TagbarToggle.
- Added an way to ignore specific files in case they create problems.
- Optionally show line numbers in the Tagbar window.
- The usual bunch of small improvements and bugfixes.
tagbar.vmb 2.5 2013-03-25 7.0 Jan Larres - New command :TagbarTogglePause to freeze Tagbar in its current state so you
  can switch to other files while keeping the old information displayed for
  reference. (Kian Ryan)
- New command :TagbarCurrentTag which reports the same information as
  currenttag().
- New option tagbar_indent to configure the indentation depth of the tags.
- New option tagbar_show_visibility to allow disabling the visibility symbols.
- Files are now cached locally to avoid additional slowdowns for slow
  connections. This also makes it possible to use Tagbar with files accessed
  through Netrw.
- Execute ctags again even if the previous run reported errors, in case it was
  a parse error that has since been fixed. If the error persists, don't
  display it again.
- Improved window switching and Vim exit behaviours. (Techlive Zheng)
- The currenttag() function now can show the prototype instead of the actual
  tag, which can be useful in some cases where ctags doesn't report all the
  interesting information.
- The prototype shown in the tooltip or command line should now always be
  complete, even if it is spread out over more than one line in the source
  file.
- The TagbarAccessPublic etc. highlight groups have been renamed to
  TagbarVisibilityPublic etc. to keep them in line with standard terminology.
  The old names are still supported.
- Various smaller improvements and bugfixes.
tagbar.vmb 2.4.1 2012-07-16 7.0 Jan Larres - Fixed some bugs related to the currenttag() function when it was called
  before the rest of the plugin was loaded. Also fail silently in case
  something goes wrong so the statusline doesn't get messed up.
- In certain cases highlighting tags in deeply nested folds could cause an
  error message.
- Spellchecking is now correctly getting disabled in the Tagbar window.
tagbar.vmb 2.4 2012-06-17 7.0 Jan Larres - New function tagbar#currenttag() that reports the current tag, for example
  for putting it into the statusline.
- New command TagbarGetTypeConfig for easy customization of an existing type.
- Type definitions now can be loaded from ftplugins.
- The autoopen() function is now a bit more flexible.
- Vala is now supported if Anjuta is installed.
- Various other small improvements and bugfixes.
tagbar.vmb 2.3 2011-12-24 7.0 Jan Larres - Add a convenience function that allows more flexible ways to automatically
  open Tagbar.
- Replace option tagbar_usearrows with tagbar_iconchars to allow custom
  characters to be specified. This helps with fonts that don't display the
  default characters properly.
- Remove the need to provide the complete jsctags configuration if jsctags is
  not found in $PATH, now only the concrete path has to be specified.
- Add debugging functionality.
tagbar.vmb 2.2 2011-11-26 7.0 Jan Larres - Small incompatible change: TagbarOpen now doesn't jump to the Tagbar window
  anymore if it is already open. Use "TagbarOpen j" instead or see its
  documentation for more options.
- Tags inside of scopes now have a header displaying their "kind".
- The Tagbar contents are now immediately updated on save for files smaller
  than a configurable size.
- Tagbar can now be configured to jump to a tag with only a single-click
  instead of a double-click.
- Most of the script has been moved to the autoload directory, so Vim startup
  should be faster (thanks to Kien N).
- Jumping to tags should work most of the time even if the file has been
  modified and not saved.
- If Ctags has been installed into the default location using Homebrew or
  MacPorts it should now be found automatically.
- Several bugfixes.
tagbar.vba 2.1 2011-05-29 7.0 Jan Larres This is mostly a bug-fix release.

- Make Tagbar work in (hopefully) all cases under Windows

- Handle cases where 'encoding' is different from system encoding, for example on a Chinese Windows with 'encoding' set to "utf-8" (see manual for details in case it doesn't work out-of-the-box)

- Fixed a bug with the handling of subtypes like "python.django"

- If a session got saved with Tagbar open it now gets restored properly

- Locally reset foldmethod/foldexpr in case foldexpr got set to something expensive globally

- Tagbar now tries hard to go to the correct window when jumping to a tag

- Explain some possible issues with the current jsctags version in the manual

- Explicitly check for some possible configuration problems to be able to give better feedback

- A few other small fixes
tagbar.vba 2.0.1 2011-04-26 7.0 Jan Larres - Fixed sorting bug when 'ignorecase' is set
tagbar.vba 2.0 2011-04-26 7.0 Jan Larres - Folding now works correctly. Folds will be preserved when leaving the Tagbar window and when switching between files. Also tag types can be configured to be folded by default, which is useful for things like includes and imports.

- DoctorJS/jsctags and other compatible programs are now supported.

- All of the highlight groups can now be overridden.

- Added keybinding to quickly jump to next/previous top-level tag.

- Added Taglist's "p" keybinding for jumping to a tag without leaving the Tagbar window.

- Several bugfixes and other small improvements.
tagbar.vba 1.5 2011-03-06 7.0 Jan Larres - Type definitions can now include a path to a file with the ctags definition. This is especially useful for ftplugins that can now ship with a complete ctags and Tagbar configuration without requiring user intervention. Thanks to Jan Christoph Ebersbach for the suggestion.

- Added autofocus setting by Taybin Rutkin. This will put the cursor in the Tagbar window when it is opened.

- The "scopes" field is no longer needed in type definitions, the information is already there in "scope2kind". Existing definitions will be ignored.

- Some fixes and improvements related to redrawing and window switching.
tagbar.vba 1.2 2011-02-28 7.0 Jan Larres - Fix typo in Ruby definition

Thanks to Mishail for reporting.
tagbar.vba 1.1 2011-02-26 7.0 Jan Larres - Don't lose syntax highlighting when ':syntax enable' is called

- Allow expanding the Vim window when Tagbar is opened

Thanks to Hansi for reporting.
tagbar.vba 1.0 2011-02-23 7.0 Jan Larres Initial upload
ip used for rating: 54.161.203.23

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo