I am using Vim to edit Fortran 90 code. The code is structured in the following manner:

  • ./srcs - contains main code file
  • ./libs - contains some module file

If I open the main file in Vim and then find some interesting function and press gD Vim cannot find this function since it does not know where to search. If I copy all the source files to one folder this option does work.

My questions are:

  1. How do I tell Vim where my code is?
  2. Can you suggest for a quick manner on how to work with this kind of folder without repeating the use of solution (1)?

Other tips and or suggestions of working with Vim to edit Fortran projects will be very much appreciated.

Thanks Rami

1 Answer 1


According to :h 29.5, gd and gD should work only in the current file, while [I will look in included files. Yet, it seem to work for you (if you copy all files in a single folder).

In any case, put this in your vimrc:

set path-=./libs
set path+=./libs

This adds your ./libs folder to the path variable.

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.