Find the answer to your Linux question:
Results 1 to 3 of 3
Hi ALL, when i 'm editing my source code,sometimes i need to see the declaraton of some struct(s),but the header files include these struct(s) are not in current directorytree,maybe in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2005
    Location
    Jilin University,China
    Posts
    15

    HELP~~~~:Question about VIM


    Hi ALL,
    when i 'm editing my source code,sometimes i need to see the declaraton of some struct(s),but the header files include these struct(s) are not in current directorytree,maybe in /sur/include/,so i can't use ctags,and using ctrl-K only get information about functions not struct(s),is there someone can help me ?
    Thanks in advance!!!!!
    for example:
    i want to see the declaration of struct socketaddr_in,how to?
    Code:
    #include <stdio.h>
          2 #include <stdlib.h>
          3 #include <errno.h>
          4 #include <string.h>
          5 #include <netdb.h>
          6 #include <sys/types.h>
          7 #include <netinet/in.h>
          8 #include <sys/socket.h>
          9 #define POP3SERVPORT 110
         10 #define MAXDATASIZE  4096
         11 int main&#40;int argc,char** argv&#41;
         12 &#123;
         13   int sockfd;
         14   struct hostent* host;
         15   &#91;color=blue&#93;struct sockaddr_in&#91;/color&#93; serv_addr;
                      ......
         16   return 0;
         59 &#125;

  2. #2
    Linux User
    Join Date
    Jul 2004
    Location
    Poland
    Posts
    368
    I believe you can use ctags even if your source resides in various directories. What you do is specify various files with the vim's 'tags' settings. A example scenario:
    Code:
    $cd /tmp/ # let the tag file for /usr/include reside in /tmp
    $ctags -R /usr/include/ # create tags file for /usr/include
    $cd ~/mysources/someproject/
    $ ctags -R . # create tags file for my projects
    Now you start (g)vim in someproject and append the tag file from /tmp/ to the tag list, by issuing
    Code:
    &#58;set tags+=/tmp/tags
    Hope this helps.
    "I don't know what I'm running from
    And I don't know where I'm running to
    There's something deep and strange inside of me I see"

  3. #3
    Just Joined!
    Join Date
    Oct 2005
    Location
    Jilin University,China
    Posts
    15

    Thank you very much : - )

    I got it ,hoho~~~~~~~
    thank U again!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •