I'm using Tagbar (with C++) and I would like to understand if and how it is possible to navigate the code as follow:

  • Find all references of a variable or methods (where the variable or method is used/called... Something like Ctrl+Shift+G in Eclipse). It would be great if they would list in the Quickfix list.
  • Leave fixed the Tagbar window while I moving around in my files. So I would like to have a toggle to stop Tagbar following me.
  • Regenerate the tags from the root folder (the current folder when I opened Vim)

1 Answer 1

  • A variety of methods are at your disposal
    • There are some very useful commands listed here, most notably [I, which will display all lines in the current and all included files containing the keyword under the cursor. See :h [I and :h include-search.
    • You can :grep or :vimgrep to search for occurrences of a particular symbol (or any pattern for that matter), and the results will be loaded into the Quickfix (or location) list which you can browse using :copen (or :lopen). See :h :grep. There is also Ag.vim.
    • You could make use of cscope, as suggested in the first part of this answer to a similar question
  • Try :TagbarTogglePause.
  • Use one of the handful of tag generation plugins floating around, or create a mapping that runs ctags. As far as Tagbar being able to do this for you, I'm uncertain. Browse :h tagbar and find out for yourself.
  • Thanks, it's what I was looking for. Just another thing, is it possible to navigate the list of occurrence (found by [I) within the Quickfix List?
    – Kill KRT
    Mar 29, 2015 at 8:44
  • Not without doing something particularly roundabout, as far as I'm aware. Might be worth asking another question.
    – ZeroKnight
    Apr 1, 2015 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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