okay, i will make this more clear here.. say i have the directory listing in a vertical split window, along with the file i'm editing..
i can go from one split to the other using Ctrl+w and open files in the file listing using netrw plugin in four ways.. using return key, v, o, t..
with return key, it opens in the current(netrw) split window.. with v, it creates a new vertical split..(same with o(horizontal split), t(new tab))
but i want the file to be opened in the other split that is already there, where i do all the editing..instead of opening a new split.. i hope my question is clear.. say by typing a command, the highlighted file will open in the editing split instead of the netrw split.. there must be some easy solution to this.. or can someone tell me the best way to use netrw.. i will try to adapt..
To launch netrw: Run vim with a directory as the command-line argument. :edit path/to/a/directory Enter (or :e <path/to/a/directory )
Netrw supports reading and writing files across networks. One may use urls for filenames or one may use netrw's Nread and Nwrite commands. Netrw as provided here supports remote and local directory browsing, and supports editing files across the network using a variety of methods.
The answer is in the doc: :h netrw
. As usual.
You are looking for P
:
To edit a file or directory in the previously used (last accessed) window (see
:he CTRL-W_p), press a "P". If there's only one window, then the one window
will be horizontally split (above/below splitting is controlled by
g:netrw_alto, and its initial size is controlled by g:netrw_winsize).
If there's more than one window, the previous window will be re-used on
the selected file/directory. If the previous window's associated buffer
has been modified, and there's only one window with that buffer, then
the user will be asked if s/he wishes to save the buffer first (yes,
no, or cancel).
Another approach: use :let g:netrw_chgwin=2 (or whatever window number you prefer). Subsequent selection of a file in netrw will then use that window for editing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With