2

I created a Drawer command to use NetRW as a file drawer with two main uses.

Note: I always use the tree listing mode.

  1. Open the working directory
  2. Find a file to allow viewing/opening its siblings

The commands are below:

" open netrw/Explore (similar to NERDTree)
command! -nargs=? Drawer if winnr("$") == 1 | Vexplore <args>| else | 1 wincmd w | Explore <args> | endif
command! DrawerCwd execute 'Drawer' getcwd()
command! DrawerFind let @/=expand("%:t") | execute 'Drawer' expand("%:p:h") | normal n

The only problem is that NetRW won't open a directory if there is already an upper directory open, and this makes my DrawerFind useles when I already have a NetRw window opened.

Here are some examples:

:Explore /foo/bar/baz  " opens /foo/bar/baz dir

:Explore /foo/bar      " move up to /foo/bar as expected

:Explore /foo/bar/baz  " won't move down to /foo/bar/baz until window is closed

How can make NetRW descend to lower directories when an upper one is already viewed?

4
  • I suppose you could netrw’s cd equivalent
    – D. Ben Knoble
    Jun 25, 2020 at 1:59
  • Can you please elaborate? :/ Jun 28, 2020 at 21:53
  • typing cd in a netrw buffer will change vim’s current directory to the one currently being browsed. That said, I don’t have the issue you’re describing when I use :e with a directory—perhaps the explore command handles a bit different
    – D. Ben Knoble
    Jun 29, 2020 at 1:58
  • 1
    Just found that it only happens whe using the tree listing style. Setting let g:netrw_liststyle=3 or typing i until tree style is selected. Jul 3, 2020 at 19:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.