In vim when I’m using :find to open another file, it misses the first component of the relative path.
For example, if I’m looking for a file that’s in:
./foo/bar/file.txt
I’ll type
:find **/file.txt
It finds the file but then tries to open
bar/file.txt
It works correctly if I type
./**/file.txt
But I’m lazy and don’t want to type that much. Is there some config I’m missing that will correctly locate and open this path?
My Solution
I simply appended the main source code dir to my path
exec "set path^=src/**"
Is your
'path'set? That (IMO) is a pretty handy way to keep from even typing the**/bit.In my setup, there’s an environment variable that defines which project I’m currently in so I use that and construct a path with that as the root. In a nutshell:
Then I can just
:find a_file.txtand it searches my src hierarchy then my scripts hierarchy for the file.