basically my workflow is as follows I have a bunch of windows open using splits in a terminal in regular vim. Sometimes I have a file open sometimes I don't I usually switch between :buf
and :tag
to get the file. Ideally I would like something that would work like :buf
but if the file is not in the buffer currently then it would preform a :e
.
Therefore to simplify:
I type :buf
and type part of a filename and hit <tab>
it gives me the match for the files and matches as much of the file as it can if the file I want is not in the buffer already I would like to still be able to type that file name and have it load the file. Usually now I have to go back and change the command from a :buf [file]
to a :e [file]
.
Is there a way to create a command that would work like a :buf
but open the file if it doesn't already exist? The reason I use :buf
to begin with is it limits the scope to files in certain directories and will match them when hitting tab. I hope I explained it correctly :).
Example:
:buf FooX[tab]
shows 4 files and has
:buf [very long path]/FooX
Now if the Exact file with prefix FooX is not shown I still want to be able to type FooXFileNotShown.cpp
and have it load it like a :e
would.
Thanks in advance for your help.