0

I want Netrw (:e) to open in same folder of the file I'm currently looking at. For example,

A
...B
   ...file1.txt
   ...file2.txt

If I run :e inside of folder A, navigate into folder B, open up file1.txt, and then run :e again, I would like Netrw to open up with B as the directory, and not A.

sudo bangbang
  • 27,127
  • 11
  • 75
  • 77
Weston
  • 1,291
  • 3
  • 12
  • 25

2 Answers2

0

Found my answer in this Vimcast. :Explore or :E will open up Netrw in the current file's directory. I got an ambiguous use of user-defined command error at first when I tried to use :E, but this SO answer helped fix that. I just had to add this command to my .vimrc, command! -nargs=* -bar -bang -count=0 -complete=dir E Explore <args>. :E only works if there are no other possible commands that start with :E.

Community
  • 1
  • 1
Weston
  • 1,291
  • 3
  • 12
  • 25
  • 1
    It's best to post the actual solution with an attribution rather than just a link to the solution. Who knows how long vimcasts will be around. – Randy Morris Jun 21 '16 at 18:34
0

Try set autochdir in your .vimrc