Loading ...
Sorry, an error occurred while loading the content.

65335Re: Finding prototypes in header files

Expand Messages
  • Justin Randall
    Feb 1, 2006
      You're right Russell, ctags -R works just as well. I should RTFM. Thanks.

      --- Russell Bateman <russ@...> wrote:

      > I have a slightly different take on this and so, my two cents...
      >
      > More easily than Justin's command is, unless I'm mistaken or lacking the
      > whole picture, ...
      >
      > ctags -R
      >
      > from the root of your source tree will do the trick. Now, you need to
      > make certain you don't have any old tag files haunting your
      > subdirectories too, so delete them. You end up with one mother tag file.
      > In .vimrc (or _vimrc if under Windows), ensure the line
      >
      > set tags=tags;
      >
      > This will make it so that Vim, not finding any local tags file, will
      > look back up the directory tree until it finds the one dominating
      > it--your new tags file.
      >
      > I'd appreciate hearing if something I'm doing leaves me in a lurch
      > somewhere. It's worked okay for me, but maybe there's some benefit to
      > Jason's method that I'm missing out on and not realizing.
      >
      > Regards,
      >
      > Russ Bateman
      >
      > Justin Randall wrote:
      > > Try using Exuberant Ctags http://ctags.sourceforge.net/ to make a tags file that you
      > can
      > > follow inside of VIM. You need to make sure that the vim path has the tags file in
      > it.
      > >
      > > To make a tags file with ctags, type the following command in a terminal from the
      > > top-level directory where your project source is.
      > >
      > > find . \( -name '*.h' -o -name '*.cpp' \) | ctags -L -
      > >
      > > This should find all of the .cpp and .h files that are in your source and construct
      > the
      > > tags file from them. After that is done, you should be able to open up any C++ file
      > with
      > > VIM and navigate through the code (go from a function to it's prototype, and more)
      > simply
      > > by pressing Ctrl-] (Control and the close bracket key) while your cursor is on the
      > > function name. You could also navigate through the codebase in a number of ways. In
      > the
      > > the discussion below the code you wish to jump to will be denoted as "THE_TAG".
      > >
      > > 1. while the cursor is on the THE_TAG: "g ctrl ]"
      > > 2. ":ts THE_TAG" or ":tselect THE_TAG"
      > > 3. ":sts THE_TAG"
      > > 4. while the cursor is on the THE_TAG: "ctrl ]"
      > > 5. ":ta THE_TAG" or ":tag THE_TAG"
      > > 6. ":sta THE_TAG"
      > > 7. "ctrl t" takes you back to the point before your last jump.
      > >
      > >
      > > Numbers 1,2,3 all prompt you to choose among multiple tag matches.
      > > Numbers 4,5,6 all jump to the first of the possibly multiple tag matches.
      > > Numbers 1 and 4 are used in "vim normal mode". Numbers 2 and 5 have the prefix ":"
      > which
      > > switches to command mode in vim. Numbers 3 and 6 are the same as 2 and 5 except a new
      > > window will be split off containing the code you just jumped to.
      > >
      > > You will want to make a few changes to your .vimrc or .gvimrc so that that things
      > work
      > > seamlessly.
      > >
      > > * set tags=./tags, OTHER_TAG_FILES
      > > * set autosave
      > >
      > > Good luck,
      > > Justin
      > >
      > > --- Ernest Obusek <eobusek@...> wrote:
      > >
      > >
      > >> Is there a direct way to go from a function in a file to its
      > >> prototype in a header file? The header file is in the vim path.
      > >>
      > >> Thanks,
      > >>
      > >> Ernest
      > >>
      > >>
      > >>
      > >
      > >
      > > __________________________________________________
      > > Do You Yahoo!?
      > > Tired of spam? Yahoo! Mail has the best spam protection around
      > > http://mail.yahoo.com
      > >
      > >
      > >
      >


      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail.yahoo.com
    • Show all 7 messages in this topic