How to open 4 netrw file explors simultaneously in format [:][:] (each dot being a netrw file explorer pane)


How to open 4 netrw file explors simultaneously in format [:][:] (each dot being a netrw file explorer pane)



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.





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 at 13:07





4 Answers
4



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:


:vertical


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



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


.



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.



Here is one way to do it:


:vsplit . | split | wincmd w | edit . | split



in vim the following works:


:e.|sp|vsp|wincmd j|vsp






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Export result set on Dbeaver to CSV

Opening a url is failing in Swift