Giter VIP home page Giter VIP logo

tagbar's Introduction

Tagbar: a class outline viewer for Vim

What Tagbar is

Tagbar is a Vim plugin that provides an easy way to browse the tags of the current file and get an overview of its structure. It does this by creating a sidebar that displays the ctags-generated tags of the current file, ordered by their scope. This means that for example methods in C++ are displayed under the class they are defined in.

What Tagbar is not

Tagbar is not a general-purpose tool for managing tags files. It only creates the tags it needs on-the-fly in-memory without creating any files. tags file management is provided by other plugins, like for example easytags.

Dependencies

Vim 7.3.1058
Exuberant Ctags 5.5 or Universal Ctags (recommended), a maintained fork of Exuberant Ctags.

Installation

Extract the archive or clone the repository into a directory in your 'runtimepath', or use a plugin manager of your choice like pathogen. Don't forget to run :helptags if your plugin manager doesn't do it for you so you can access the documentation with :help tagbar.

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

Quickstart

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

nmap <F8> :TagbarToggle<CR>

If you do this 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.

Support for additional filetypes

For filetypes that are not supported by Exuberant Ctags check out the wiki to see whether other projects offer support for them and how to use them. Please add any other projects/configurations that you find or create yourself so that others can benefit from them, too.

Note: If the file structure display is wrong

If you notice that there are some errors in the way your file's structure is displayed in Tagbar, please make sure that the bug is actually in Tagbar before you report an issue. Since Tagbar uses exuberant-ctags and compatible programs to do the actual file parsing, it is likely that the bug is actually in the program responsible for that filetype instead.

There is an example in :h tagbar-issues about how to run ctags manually so you can determine where the bug actually is. If the bug is actually in ctags, please report it on their website instead, as there is nothing I can do about it in Tagbar. Thank you!

You can also have a look at ctags bugs that have previously been filed against Tagbar.

Screenshots

screenshot1 screenshot2

License

Vim license, see LICENSE

Maintainer

Jan Larres <[email protected]>

tagbar's People

Contributors

majutsushi avatar jpmv27 avatar weynhamz avatar inkarkat avatar kien avatar kianryan avatar adnoc avatar weirdan avatar darcyparker avatar miteshathia avatar alejandrogallo avatar nhooyr avatar chesleytan avatar wdv4758h avatar h3xx avatar joegrasse avatar jszakmeister avatar freitass avatar teto avatar micrub avatar niloct avatar typekpb avatar ruchee avatar sethwoodworth avatar taybin avatar ithinuel avatar cofyc avatar zhaocai avatar zmx avatar natfitz avatar

Stargazers

eg avatar L8ng avatar Michael Goerz avatar

Watchers

Dan Barrett avatar

tagbar's Issues

v:shell_error undefined

The original plugin uses the global read-only variablev:shell_error in a number of places. For example:

if v:shell_error || ctags_output !~# '\(Exuberant\|Universal\) Ctags'
    let errmsg = 'Tagbar: Ctags doesn''t seem to be Exuberant Ctags!'
    ...

Generally, v:shell_error contains the exit code of the last call to system. Within the tagbar plugin, it is set specifically in ExecuteCmd. In iVim, instead of system, the ictags vim-command is executed directly. Thus, v:shell_error is not set (and stays at the value that it had from some previous system call, presumably from outside of the tagbar plugin)

What happens to me in practice is that when I call :TagbarOpen, thev:shell_error is set to some "random" non-zero value โ€“ presumably, I have some plugins executing failing commands in the background? This then causes the "Ctags doesn't seem to be Exuberant Ctags" message. When I manually run something like :!ls, which exits successfully with exit code 0, :TagbarOpen works.

I imagine the fix would be to have a script-local s:shell_error variable that should be used anywhere v:shell_error is used at the moment. Then, inside ExecuteCmd, one would have to set s:shell_error to v:shell_error after the system call, and for ivim, s:shell_error = 0 after the call to ictags. This assumes ictags never fails; if it does, one would have to detect that and set s:shell_error accordingly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.