How do I edit a header file with the same name as the corresponding C

source file? You can use the following command to edit a header file with the same name as the corresponding C source file:

    :e %:t:r.h

You can use the following command to edit the file in a new split window:

    :sp %:t:r.h

In the above commands, the percent sign expands to the name of the current file. The “:t” modifier extracts the tail (last component) of the filename. The “:r” modifier extracts the root of the filename. The .h is appended to the resulting name to get the header filename. Another approach is to use the following command:

    :sfind %:t:r.h

This command will search for the header file in the directories specified in the ‘path’ option.

Comments (1)


Pepsh Pepshinsky

Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE


Speak Your Mind