Skip to main content
added 8 characters in body
Source Link
romainl
  • 42.3k
  • 5
  • 87
  • 118

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.

When you do :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.

When you do:

: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.

Source Link
romainl
  • 42.3k
  • 5
  • 87
  • 118

When you do :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.