When you do :vsplit %:p:h/foo.bar
,:
:vsplit %:p:h/foo.bar
Vim expands %:p:h
to the full path of the directory containing the current file. This means that you give Vim the full path of foo.bar
, which becomes the name of the associated buffer. In other words, you get exactly what you asked for.
If you prefer your buffers to be named after their relative path, then… use a relative path:
:vsplit %:h/foo.bar
See :help filename-modifiers
.