0

In vim or neovim I can do the following

:e.|vs.|vs.|sp.

To open various netrw file explorers simultaneously. The command above results in the following layout:

|netrw0|netrw1|netrw2|
|      |      |netrw3|

Now what I want to accomplish is a oneliner which results in the following layout:

|netrw0|netrw2|
|netrw1|netrw3|

I'm not sure if this is possible, ofcourse I can switch panes to get the above result, however that is not what I want because the thing I'm actually doing is creating a function in my vimrc which I link to a function key, that way I can press a function key and open the desired splitted file browsing layout.

ps. in my .init.vim (I'm using neovim), I have "set splitright" in order to open vertical splitted windows by default on the right side.

Gio
  • 3,242
  • 1
  • 25
  • 53
  • Turned out easier than I thought and I've discovered the solution quite quickly, in the time that I've answered my own question multiple correct answers arrived. – Gio Jun 29 '18 at 13:07

4 Answers4

1

Check the help for :vertical. There are a lot of commands to switch position of windows at their creation. This one is a possible solution for your case:

:e 0 | sp 1 | bo vs 2 | sp 3

(I changed the . to numbers for demonstration purposes only).

sidyll
  • 57,726
  • 14
  • 108
  • 151
0

With the command :wincmd it is possible to switch panes from the command line. The following oneliner result in the desired layout:

:e.|vs.|wincmd h|wincmd h|sp.|wincmd l|sp.

Gio
  • 3,242
  • 1
  • 25
  • 53
0

Here is one way to do it:

:vsplit . | split | wincmd w | edit . | split
romainl
  • 186,200
  • 21
  • 280
  • 313
0

in vim the following works:

:e.|sp|vsp|wincmd j|vsp 
rgt47
  • 316
  • 1
  • 4