1

If I've already opened a tab with:

:tabe

Is it possible to load the file in that tab? For example, to do something like:

:o ~/.vimrc

In other words, instead of doing :tabe ~/.vimrc, can I do that in two commands (one to open the new tab and another to open that file)?

5
  • Have you tried that? It works for me... Does it not work for you?
    – filbranden
    Apr 15 '20 at 5:26
  • @filbranden -- what's the difference between :e and :o. For whatever reason, :e was working for me but not the other...
    – David542
    Apr 15 '20 at 5:26
  • 1
    :e is the correct command to use. :open is a legacy command/mode from the original Vi that is emulated in Vim.
    – filbranden
    Apr 15 '20 at 5:29
  • See vi.stackexchange.com/q/2275/18609
    – filbranden
    Apr 15 '20 at 5:31
  • :e is correct, I use this all the time. It's also handy to map a shortcut key to open a tab to something that also works in other apps, like CTRL-T ;)
    – jurgenb
    Apr 15 '20 at 9:37
2

You’re looking for :tabnew followed by :edit file (but why? :tabedit does the same and is shorter).

I believe <C-w>T will also break the current window into a new tab.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.