How do I open an already-loaded buffer in a new tab without re-reading it from disk?
Answer
:tab sbuffer {bufnr}<CR>
Explanation
If a file is already loaded as a buffer, reopening it with :tabedit can trigger another read and may lose the exact in-memory context you want. :tab sbuffer opens that existing buffer in a new tab page directly, which is ideal when you want a focused workspace while keeping the original window setup intact. This is especially useful during refactors where one buffer is a reference and another is your active edit surface.
How it works
:tabruns the following command in a new tab pagesbuffer {bufnr}opens an existing buffer in a split-style context without creating a new buffer instance{bufnr}is the numeric buffer ID (check with:ls)
Because it reuses a loaded buffer, you keep unsaved in-memory state and avoid duplicate buffer confusion.
Example
List buffers first:
:ls
Assume buffer 7 is a reference file you want in a dedicated tab. Run:
:tab sbuffer 7
Now that same buffer opens in a new tab, while your original tab layout remains available.
Tips
- Use
:ls tto include tab/window placement when choosing the target buffer - Combine with
:keepaltif you need to preserve alternate-file behavior in larger workflows - Prefer this over reopening paths when you care about exact buffer state