3

When using netrw as :Lex, opening a file simply replaces the current file open. How do I open a file in a new tab from Lex or in a new vertical split?

3
  • What is a Lex? Why is this tagged Vim? Commented Jul 12, 2020 at 9:10
  • :Lexplore or :Lex in shortcut, opens netrw on the left side of vim. Commented Jul 12, 2020 at 10:26
  • If they were going to migrate this, they might as well have migrated to Vi and Vim. Commented Jul 12, 2020 at 10:33

1 Answer 1

3

See :h netrw-t:

BROWSING WITH A NEW TAB                         netrw-t

Normally one enters a file or directory using the <cr>.  The "t" map
allows one to open a new window holding the new directory listing or file in
a new tab.

If you'd like to have the new listing in a background tab, use gT.

And :h netrw-v:

BROWSING WITH A VERTICALLY SPLIT WINDOW                 netrw-v

Normally one enters a file or directory using the <cr>.  However, the "v" map
allows one to open a new window to hold the new directory listing or file.  A
vertical split is used.  (for horizontal splitting, see netrw-o)

Normally, the v key splits the window vertically with the new window and
cursor at the left.

Just press t instead of pressing Enter for a new tab, or v for a new vertical split.

2
  • Thanks. While opening file in a new tab with t, it opens the file in a new unsplit window. Can I modify it to act like other IDEs, i.e. open the file tabed in the existing right split window? I couldn't find this in :h netrw-t Commented Jul 12, 2020 at 10:55
  • In Vim, tabs contain splits. Splits can't contain tabs. Commented Jul 12, 2020 at 11:47

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.