Search code examples
cvimheader-files

Opening a C library header file in Vim


Say I'm including a header file in vim while writing a C program, e.g

#include <time.h>

I have no idea what structures or functions are declared there. How can I jump to that file and open it in Vim? Is there any way to do that?


Solution

  • On Unix-like systems, Vim is already wired for C by default so you only have to move the cursor to <time.h> and press gf, to open the header in the same window or <C-w>f to open it in a new window.

    See this answer to a similar question that was asked a few hours ago for additional pointers.