How do I open a file to view in a new tab? Specifically, I want the read-only equivalent of
:tabe[dit] <filename>. I have tried
:tab :view <filename>
but that does not create a new tab as the documentation would suggest.
:tab <cmd> opens a tab where a
<cmd> would have opened a window.
:view doesn't open a window, so
:tab view doesn't open a tab :-) See
However, we also have the
:sview command, which does:
Same as ":split", but set 'readonly' option for this buffer.
This does open a window. So
:tab sview file opens a tab.
:sview is short for "split view". You can abbreviate to to
:sv, and you can also leave out the second
Your question suggests you're not very familiar with Vi/Vim terminology. Many people are confused about this, so don't worry :-)
:help window is a good read for an introduction. It has a useful summary at the start:
A buffer is the in-memory text of a file.
A window is a viewport on a buffer.
A tab page is a collection of windows.